]> Kevux Git Server - rit/log
rit
7 years agoSync with Git 2.14.4
Junio C Hamano [Thu, 27 Sep 2018 18:20:22 +0000 (11:20 -0700)]
Sync with Git 2.14.4

* maint-2.14:
  Git 2.14.5
  submodule-config: ban submodule paths that start with a dash
  submodule-config: ban submodule urls that start with dash
  submodule--helper: use "--" to signal end of clone options

7 years agoGit 2.14.5
Junio C Hamano [Thu, 27 Sep 2018 18:19:11 +0000 (11:19 -0700)]
Git 2.14.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agosubmodule-config: ban submodule paths that start with a dash
Jeff King [Mon, 24 Sep 2018 08:39:55 +0000 (04:39 -0400)]
submodule-config: ban submodule paths that start with a dash

We recently banned submodule urls that look like
command-line options. This is the matching change to ban
leading-dash paths.

As with the urls, this should not break any use cases that
currently work. Even with our "--" separator passed to
git-clone, git-submodule.sh gets confused. Without the code
portion of this patch, the clone of "-sub" added in t7417
would yield results like:

    /path/to/git-submodule: 410: cd: Illegal option -s
    /path/to/git-submodule: 417: cd: Illegal option -s
    /path/to/git-submodule: 410: cd: Illegal option -s
    /path/to/git-submodule: 417: cd: Illegal option -s
    Fetched in submodule path '-sub', but it did not contain b56243f8f4eb91b2f1f8109452e659f14dd3fbe4. Direct fetching of that commit failed.

Moreover, naively adding such a submodule doesn't work:

  $ git submodule add $url -sub
  The following path is ignored by one of your .gitignore files:
  -sub

even though there is no such ignore pattern (the test script
hacks around this with a well-placed "git mv").

Unlike leading-dash urls, though, it's possible that such a
path _could_ be useful if we eventually made it work. So
this commit should be seen not as recommending a particular
policy, but rather temporarily closing off a broken and
possibly dangerous code-path. We may revisit this decision
later.

There are two minor differences to the tests in t7416 (that
covered urls):

  1. We don't have a "./-sub" escape hatch to make this
     work, since the submodule code expects to be able to
     match canonical index names to the path field (so you
     are free to add submodule config with that path, but we
     would never actually use it, since an index entry would
     never start with "./").

  2. After this patch, cloning actually succeeds. Since we
     ignore the submodule.*.path value, we fail to find a
     config stanza for our submodule at all, and simply
     treat it as inactive. We still check for the "ignoring"
     message.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agosubmodule-config: ban submodule urls that start with dash
Jeff King [Mon, 24 Sep 2018 08:36:30 +0000 (04:36 -0400)]
submodule-config: ban submodule urls that start with dash

The previous commit taught the submodule code to invoke our
"git clone $url $path" with a "--" separator so that we
aren't confused by urls or paths that start with dashes.

However, that's just one code path. It's not clear if there
are others, and it would be an easy mistake to add one in
the future. Moreover, even with the fix in the previous
commit, it's quite hard to actually do anything useful with
such an entry. Any url starting with a dash must fall into
one of three categories:

 - it's meant as a file url, like "-path". But then any
   clone is not going to have the matching path, since it's
   by definition relative inside the newly created clone. If
   you spell it as "./-path", the submodule code sees the
   "/" and translates this to an absolute path, so it at
   least works (assuming the receiver has the same
   filesystem layout as you). But that trick does not apply
   for a bare "-path".

 - it's meant as an ssh url, like "-host:path". But this
   already doesn't work, as we explicitly disallow ssh
   hostnames that begin with a dash (to avoid option
   injection against ssh).

 - it's a remote-helper scheme, like "-scheme::data". This
   _could_ work if the receiver bends over backwards and
   creates a funny-named helper like "git-remote--scheme".
   But normally there would not be any helper that matches.

Since such a url does not work today and is not likely to do
anything useful in the future, let's simply disallow them
entirely. That protects the existing "git clone" path (in a
belt-and-suspenders way), along with any others that might
exist.

Our tests cover two cases:

  1. A file url with "./" continues to work, showing that
     there's an escape hatch for people with truly silly
     repo names.

  2. A url starting with "-" is rejected.

Note that we expect case (2) to fail, but it would have done
so even without this commit, for the reasons given above.
So instead of just expecting failure, let's also check for
the magic word "ignoring" on stderr. That lets us know that
we failed for the right reason.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agosubmodule--helper: use "--" to signal end of clone options
Jeff King [Mon, 24 Sep 2018 08:32:15 +0000 (04:32 -0400)]
submodule--helper: use "--" to signal end of clone options

When we clone a submodule, we call "git clone $url $path".
But there's nothing to say that those components can't begin
with a dash themselves, confusing git-clone into thinking
they're options. Let's pass "--" to make it clear what we
expect.

There's no test here, because it's actually quite hard to
make these names work, even with "git clone" parsing them
correctly. And we're going to restrict these cases even
further in future commits. So we'll leave off testing until
then; this is just the minimal fix to prevent us from doing
something stupid with a badly formed entry.

Reported-by: joernchen <joernchen@phenoelit.de>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoread-cache.c: optimize reading index format v4
Nguyễn Thái Ngọc Duy [Wed, 26 Sep 2018 19:54:36 +0000 (15:54 -0400)]
read-cache.c: optimize reading index format v4

Index format v4 requires some more computation to assemble a path
based on a previous one. The current code is not very efficient
because

 - it doubles memory copy, we assemble the final path in a temporary
   first before putting it back to a cache_entry

 - strbuf_remove() in expand_name_field() is not exactly a good fit
   for stripping a part at the end, _setlen() would do the same job
   and is much cheaper.

 - the open-coded loop to find the end of the string in
   expand_name_field() can't beat an optimized strlen()

This patch avoids the temporary buffer and writes directly to the new
cache_entry, which addresses the first two points. The last point
could also be avoided if the total string length fits in the first 12
bits of ce_flags, if not we fall back to strlen().

Running "test-tool read-cache 100" on webkit.git (275k files), reading
v2 only takes 4.226 seconds, while v4 takes 5.711 seconds, 35% more
time. The patch reduces read time on v4 to 4.319 seconds.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agomailmap: consistently normalize brian m. carlson's name
Jonathan Nieder [Mon, 24 Sep 2018 17:39:02 +0000 (10:39 -0700)]
mailmap: consistently normalize brian m. carlson's name

v2.18.0-rc0~70^2 (mailmap: update brian m. carlson's email address,
2018-05-08) changed the mailmap to map

  sandals@crustytoothpaste.ath.cx
   -> brian m. carlson <sandals@crustytoothpaste.net>

instead of

  sandals@crustytoothpaste.net
    -> brian m. carlson <sandals@crustytoothpaste.ath.cx>

That means the mapping

  Brian M. Carlson <sandals@crustytoothpaste.ath.cx>
    -> brian m. carlson <sandals@crustytoothpaste.net>

is redundant, so we can remove it.  More importantly, it means that
the identity "Brian M. Carlson <sandals@crustytoothpaste.net>" used in
some commits is not normalized any more.  Add a mapping for it.

Noticed while updating Debian's Git packaging, which uses "git
shortlog --no-merges" to produce a list of changes in each version,
grouped by author's (normalized) name.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoreceive-pack: update comment with check_everything_connected
Jeff King [Fri, 21 Sep 2018 23:04:45 +0000 (19:04 -0400)]
receive-pack: update comment with check_everything_connected

That function is now called "check_connected()", but we forgot to update
this comment in 7043c7071c (check_everything_connected: use a struct
with named options, 2016-07-15).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agocommit-reach: cleanups in can_all_from_reach...
Derrick Stolee [Tue, 25 Sep 2018 13:27:41 +0000 (13:27 +0000)]
commit-reach: cleanups in can_all_from_reach...

Due to a regression introduced by 4fbcca4e "commit-reach: make
can_all_from_reach... linear" the series including b67f6b26
"commit-reach: properly peel tags" was merged to master quickly.

There were a few more cleanups left to apply in the series, which
are included by this change:

1. Clean up a comment that is in the incorrect style.

2. Replace multiple calls to clear_commit_marks() with one call to
   clear_commit_marks_many().

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoSecond batch post 2.19
Junio C Hamano [Mon, 24 Sep 2018 17:31:26 +0000 (10:31 -0700)]
Second batch post 2.19

7 years agoMerge branch 'tg/range-diff-corner-case-fix'
Junio C Hamano [Mon, 24 Sep 2018 17:30:53 +0000 (10:30 -0700)]
Merge branch 'tg/range-diff-corner-case-fix'

Recently added "range-diff" had a corner-case bug to cause it
segfault, which has been corrected.

* tg/range-diff-corner-case-fix:
  linear-assignment: fix potential out of bounds memory access

7 years agoMerge branch 'sg/split-index-test'
Junio C Hamano [Mon, 24 Sep 2018 17:30:53 +0000 (10:30 -0700)]
Merge branch 'sg/split-index-test'

Test updates.

* sg/split-index-test:
  t0090: disable GIT_TEST_SPLIT_INDEX for the test checking split index
  t1700-split-index: drop unnecessary 'grep'

7 years agoMerge branch 'en/update-ref-no-deref-stdin'
Junio C Hamano [Mon, 24 Sep 2018 17:30:53 +0000 (10:30 -0700)]
Merge branch 'en/update-ref-no-deref-stdin'

"git update-ref" learned to make both "--no-deref" and "--stdin"
work at the same time.

* en/update-ref-no-deref-stdin:
  update-ref: allow --no-deref with --stdin
  update-ref: fix type of update_flags variable to match its usage

7 years agoMerge branch 'ms/remote-error-message-update'
Junio C Hamano [Mon, 24 Sep 2018 17:30:52 +0000 (10:30 -0700)]
Merge branch 'ms/remote-error-message-update'

Update error messages given by "git remote" and make them consistent.

* ms/remote-error-message-update:
  builtin/remote: quote remote name on error to display empty name

7 years agoMerge branch 'jt/lazy-object-fetch-fix'
Junio C Hamano [Mon, 24 Sep 2018 17:30:52 +0000 (10:30 -0700)]
Merge branch 'jt/lazy-object-fetch-fix'

The code to backfill objects in lazily cloned repository did not
work correctly, which has been corrected.

* jt/lazy-object-fetch-fix:
  fetch-object: set exact_oid when fetching
  fetch-object: unify fetch_object[s] functions

7 years agoMerge branch 'en/sequencer-empty-edit-result-aborts'
Junio C Hamano [Mon, 24 Sep 2018 17:30:52 +0000 (10:30 -0700)]
Merge branch 'en/sequencer-empty-edit-result-aborts'

"git rebase" etc. in Git 2.19 fails to abort when given an empty
commit log message as result of editing, which has been corrected.

* en/sequencer-empty-edit-result-aborts:
  sequencer: fix --allow-empty-message behavior, make it smarter

7 years agoMerge branch 'ds/reachable'
Junio C Hamano [Mon, 24 Sep 2018 17:30:52 +0000 (10:30 -0700)]
Merge branch 'ds/reachable'

Recent update broke the reachability algorithm when refs (e.g.
tags) that point at objects that are not commit were involved,
which has been fixed.

* ds/reachable:
  commit-reach: fix memory and flag leaks
  commit-reach: properly peel tags

7 years agoMerge branch 'nd/attr-pathspec-fix'
Junio C Hamano [Mon, 24 Sep 2018 17:30:51 +0000 (10:30 -0700)]
Merge branch 'nd/attr-pathspec-fix'

"git add ':(attr:foo)'" is not supported and is supposed to be
rejected while the command line arguments are parsed, but we fail
to reject such a command line upfront.

* nd/attr-pathspec-fix:
  add: do not accept pathspec magic 'attr'

7 years agoMerge branch 'bw/protocol-v2'
Junio C Hamano [Mon, 24 Sep 2018 17:30:50 +0000 (10:30 -0700)]
Merge branch 'bw/protocol-v2'

Doc fix.

* bw/protocol-v2:
  config: document value 2 for protocol.version

7 years agoMerge branch 'sb/string-list-remove-unused'
Junio C Hamano [Mon, 24 Sep 2018 17:30:50 +0000 (10:30 -0700)]
Merge branch 'sb/string-list-remove-unused'

Code clean-up.

* sb/string-list-remove-unused:
  string-list: remove unused function print_string_list

7 years agoMerge branch 'jk/dev-build-format-security'
Junio C Hamano [Mon, 24 Sep 2018 17:30:49 +0000 (10:30 -0700)]
Merge branch 'jk/dev-build-format-security'

Build tweak to help developers.

* jk/dev-build-format-security:
  config.mak.dev: add -Wformat-security

7 years agoMerge branch 'sg/t3701-tighten-trace'
Junio C Hamano [Mon, 24 Sep 2018 17:30:49 +0000 (10:30 -0700)]
Merge branch 'sg/t3701-tighten-trace'

Test update.

* sg/t3701-tighten-trace:
  t3701-add-interactive: tighten the check of trace output

7 years agoMerge branch 'sb/diff-color-move-more'
Junio C Hamano [Mon, 24 Sep 2018 17:30:48 +0000 (10:30 -0700)]
Merge branch 'sb/diff-color-move-more'

Bugfix.

* sb/diff-color-move-more:
  diff: fix --color-moved-ws=allow-indentation-change

7 years agoMerge branch 'en/rerere-multi-stage-1-fix'
Junio C Hamano [Mon, 24 Sep 2018 17:30:48 +0000 (10:30 -0700)]
Merge branch 'en/rerere-multi-stage-1-fix'

A corner case bugfix in "git rerere" code.

* en/rerere-multi-stage-1-fix:
  rerere: avoid buffer overrun
  t4200: demonstrate rerere segfault on specially crafted merge

7 years agoMerge branch 'js/mingw-o-append'
Junio C Hamano [Mon, 24 Sep 2018 17:30:47 +0000 (10:30 -0700)]
Merge branch 'js/mingw-o-append'

Further fix for O_APPEND emulation on Windows

* js/mingw-o-append:
  mingw: fix mingw_open_append to work with named pipes
  t0051: test GIT_TRACE to a windows named pipe

7 years agoMerge branch 'en/double-semicolon-fix'
Junio C Hamano [Mon, 24 Sep 2018 17:30:47 +0000 (10:30 -0700)]
Merge branch 'en/double-semicolon-fix'

Code clean-up.

* en/double-semicolon-fix:
  Remove superfluous trailing semicolons

7 years agoMerge branch 'jk/reopen-tempfile-truncate'
Junio C Hamano [Mon, 24 Sep 2018 17:30:46 +0000 (10:30 -0700)]
Merge branch 'jk/reopen-tempfile-truncate'

Fix for a long-standing bug that leaves the index file corrupt when
it shrinks during a partial commit.

* jk/reopen-tempfile-truncate:
  reopen_tempfile(): truncate opened file

7 years agoMerge branch 'bp/mv-submodules-with-fsmonitor'
Junio C Hamano [Mon, 24 Sep 2018 17:30:46 +0000 (10:30 -0700)]
Merge branch 'bp/mv-submodules-with-fsmonitor'

When fsmonitor is in use, after operation on submodules updates
.gitmodules, we lost track of the fact that we did so and relied on
stale fsmonitor data.

* bp/mv-submodules-with-fsmonitor:
  git-mv: allow submodules and fsmonitor to work together

7 years agoMerge branch 'ds/format-patch-range-diff-test'
Junio C Hamano [Mon, 24 Sep 2018 17:30:45 +0000 (10:30 -0700)]
Merge branch 'ds/format-patch-range-diff-test'

* ds/format-patch-range-diff-test:
  t3206-range-diff.sh: cover single-patch case

7 years agoMerge branch 'tb/void-check-attr'
Junio C Hamano [Mon, 24 Sep 2018 17:30:45 +0000 (10:30 -0700)]
Merge branch 'tb/void-check-attr'

Code clean-up.

* tb/void-check-attr:
  Make git_check_attr() a void function

7 years agoMerge branch 'js/rebase-i-autosquash-fix'
Junio C Hamano [Mon, 24 Sep 2018 17:30:45 +0000 (10:30 -0700)]
Merge branch 'js/rebase-i-autosquash-fix'

"git rebase -i" did not clear the state files correctly when a run
of "squash/fixup" is aborted and then the user manually amended the
commit instead, which has been corrected.

* js/rebase-i-autosquash-fix:
  rebase -i: be careful to wrap up fixup/squash chains
  rebase -i --autosquash: demonstrate a problem skipping the last squash

7 years agot5551: compare sorted cookies files
Thomas Gummerer [Mon, 17 Sep 2018 21:46:28 +0000 (22:46 +0100)]
t5551: compare sorted cookies files

In t5551 we check that we save cookies correctly to a file when
http.cookiefile and http.savecookies are set.  To do so we create an
expect file that expects the cookies in a certain order.

However after e2ef8d6fa ("cookies: support creation-time attribute for
cookies", 2018-08-28) in curl.git (released in curl 7.61.1) that order
changed.

We document the file format as "Netscape/Mozilla cookie file
format (see curl(1))", so any format produced by libcurl should be
fine here.  Sort the files, to be agnostic to the order of the
cookies, and make the test pass with both curl versions > 7.61.1 and
earlier curl versions.

Reported-by: Todd Zullinger <tmz@pobox.com>
Helped-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agot5551: move setup code inside test_expect blocks
Thomas Gummerer [Mon, 17 Sep 2018 21:46:27 +0000 (22:46 +0100)]
t5551: move setup code inside test_expect blocks

Move setup code inside test_expect blocks, to catch unexpected
failures in the setup steps, and bring the test scripts in line with
our modern test style.

Suggested-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agofetch: in partial clone, check presence of targets
Jonathan Tan [Fri, 21 Sep 2018 18:22:38 +0000 (11:22 -0700)]
fetch: in partial clone, check presence of targets

When fetching an object that is known as a promisor object to the local
repository, the connectivity check in quickfetch() in builtin/fetch.c
succeeds, causing object transfer to be bypassed. However, this should
not happen if that object is merely promised and not actually present.

Because this happens, when a user invokes "git fetch origin <sha-1>" on
the command-line, the <sha-1> object may not actually be fetched even
though the command returns an exit code of 0. This is a similar issue
(but with a different cause) to the one fixed by a0c9016abd
("upload-pack: send refs' objects despite "filter"", 2018-07-09).

Therefore, update quickfetch() to also directly check for the presence
of all objects to be fetched. Its documentation and name are also
updated to better reflect what it does.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoconnected: document connectivity in partial clones
Jonathan Tan [Fri, 21 Sep 2018 18:22:37 +0000 (11:22 -0700)]
connected: document connectivity in partial clones

In acb0c57260 ("fetch: support filters", 2017-12-08), check_connected()
was extended to allow objects to either be promised to be available (if
the repository is a partial clone) or to be present; previously, this
function required the latter. However, this change was not reflected in
the documentation of that function. Update the documentation
accordingly.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agocommit-reach: fix memory and flag leaks
Derrick Stolee [Fri, 21 Sep 2018 15:05:27 +0000 (08:05 -0700)]
commit-reach: fix memory and flag leaks

The can_all_from_reach_with_flag() method uses 'assign_flag' as a
value we can use to mark objects temporarily during our commit walk.
The intent is that these flags are removed from all objects before
returning. However, this is not the case.

The 'from' array could also contain objects that are not commits, and
we mark those objects with 'assign_flag'. Add a loop to the 'cleanup'
section that removes these markers.

Also, we forgot to free() the memory for 'list', so add that to the
'cleanup' section.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agocommit-reach: properly peel tags
Derrick Stolee [Fri, 21 Sep 2018 15:05:26 +0000 (08:05 -0700)]
commit-reach: properly peel tags

The can_all_from_reach_with_flag() algorithm was refactored in 4fbcca4e
"commit-reach: make can_all_from_reach... linear" but incorrectly
assumed that all objects provided were commits. During a fetch
negotiation, ok_to_give_up() in upload-pack.c may provide unpeeled tags
to the 'from' array. The current code creates a segfault.

Add a direct call to can_all_from_reach_with_flag() in 'test-tool reach'
and add a test in t6600-test-reach.sh that demonstrates this segfault.

Correct the issue by peeling tags when investigating the initial list
of objects in the 'from' array.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorevision.c: reduce implicit dependency the_repository
Nguyễn Thái Ngọc Duy [Fri, 21 Sep 2018 15:57:39 +0000 (17:57 +0200)]
revision.c: reduce implicit dependency the_repository

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorevision.c: remove implicit dependency on the_index
Nguyễn Thái Ngọc Duy [Fri, 21 Sep 2018 15:57:38 +0000 (17:57 +0200)]
revision.c: remove implicit dependency on the_index

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agows.c: remove implicit dependency on the_index
Nguyễn Thái Ngọc Duy [Fri, 21 Sep 2018 15:57:37 +0000 (17:57 +0200)]
ws.c: remove implicit dependency on the_index

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agotree-diff.c: remove implicit dependency on the_index
Nguyễn Thái Ngọc Duy [Fri, 21 Sep 2018 15:57:36 +0000 (17:57 +0200)]
tree-diff.c: remove implicit dependency on the_index

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agosubmodule.c: remove implicit dependency on the_index
Nguyễn Thái Ngọc Duy [Fri, 21 Sep 2018 15:57:35 +0000 (17:57 +0200)]
submodule.c: remove implicit dependency on the_index

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoline-range.c: remove implicit dependency on the_index
Nguyễn Thái Ngọc Duy [Fri, 21 Sep 2018 15:57:34 +0000 (17:57 +0200)]
line-range.c: remove implicit dependency on the_index

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agouserdiff.c: remove implicit dependency on the_index
Nguyễn Thái Ngọc Duy [Fri, 21 Sep 2018 15:57:33 +0000 (17:57 +0200)]
userdiff.c: remove implicit dependency on the_index

[jc: squashed in missing forward decl in userdiff.h found by Ramsay]

Helped-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorerere.c: remove implicit dependency on the_index
Nguyễn Thái Ngọc Duy [Fri, 21 Sep 2018 15:57:32 +0000 (17:57 +0200)]
rerere.c: remove implicit dependency on the_index

The reason rerere(), rerere_forget() and rerere_remaining() take a
struct repository instead of struct index_state is not obvious from
the patch:

Deep in update_paths() and find_conflict(), hold_locked_index() and
read_index() are called. These functions assumes the index path at
$GIT_DIR/index which is not always true when you take an arbitrary
index state. Taking a repository will allow us to point to the right
index path later when we replace them with repo_ versions.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agosha1-file.c: remove implicit dependency on the_index
Nguyễn Thái Ngọc Duy [Fri, 21 Sep 2018 15:57:31 +0000 (17:57 +0200)]
sha1-file.c: remove implicit dependency on the_index

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agopatch-ids.c: remove implicit dependency on the_index
Nguyễn Thái Ngọc Duy [Fri, 21 Sep 2018 15:57:30 +0000 (17:57 +0200)]
patch-ids.c: remove implicit dependency on the_index

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agomerge.c: remove implicit dependency on the_index
Nguyễn Thái Ngọc Duy [Fri, 21 Sep 2018 15:57:29 +0000 (17:57 +0200)]
merge.c: remove implicit dependency on the_index

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agomerge-blobs.c: remove implicit dependency on the_index
Nguyễn Thái Ngọc Duy [Fri, 21 Sep 2018 15:57:28 +0000 (17:57 +0200)]
merge-blobs.c: remove implicit dependency on the_index

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoll-merge.c: remove implicit dependency on the_index
Nguyễn Thái Ngọc Duy [Fri, 21 Sep 2018 15:57:27 +0000 (17:57 +0200)]
ll-merge.c: remove implicit dependency on the_index

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agodiff-lib.c: remove implicit dependency on the_index
Nguyễn Thái Ngọc Duy [Fri, 21 Sep 2018 15:57:26 +0000 (17:57 +0200)]
diff-lib.c: remove implicit dependency on the_index

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoread-cache.c: remove implicit dependency on the_index
Nguyễn Thái Ngọc Duy [Fri, 21 Sep 2018 15:57:25 +0000 (17:57 +0200)]
read-cache.c: remove implicit dependency on the_index

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agodiff.c: remove implicit dependency on the_index
Nguyễn Thái Ngọc Duy [Fri, 21 Sep 2018 15:57:24 +0000 (17:57 +0200)]
diff.c: remove implicit dependency on the_index

A new variant repo_diff_setup() is added that takes 'struct repository *'
and diff_setup() becomes a thin macro around it that is protected by
NO_THE_REPOSITORY_COMPATIBILITY_MACROS, similar to NO_THE_INDEX_....
The plan is these macros will always be defined for all library files
and the macros are only accessible in builtin/

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agogrep.c: remove implicit dependency on the_index
Nguyễn Thái Ngọc Duy [Fri, 21 Sep 2018 15:57:23 +0000 (17:57 +0200)]
grep.c: remove implicit dependency on the_index

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agodiff.c: remove the_index dependency in textconv() functions
Nguyễn Thái Ngọc Duy [Fri, 21 Sep 2018 15:57:22 +0000 (17:57 +0200)]
diff.c: remove the_index dependency in textconv() functions

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoblame.c: rename "repo" argument to "r"
Nguyễn Thái Ngọc Duy [Fri, 21 Sep 2018 15:57:21 +0000 (17:57 +0200)]
blame.c: rename "repo" argument to "r"

The current naming convention for 'struct repository *' is 'r' for
temporary variables or arguments. I did not notice this. Since we're
updating blame.c again in the next patch, let's fix this.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agocombine-diff.c: remove implicit dependency on the_index
Nguyễn Thái Ngọc Duy [Fri, 21 Sep 2018 15:57:20 +0000 (17:57 +0200)]
combine-diff.c: remove implicit dependency on the_index

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agodiff.c: reduce implicit dependency on the_index
Nguyễn Thái Ngọc Duy [Fri, 21 Sep 2018 15:57:19 +0000 (17:57 +0200)]
diff.c: reduce implicit dependency on the_index

diff and textconv code has so widespread use that it's hard to simply
update their api and all call sites at once because it would result in
a big patch. For now reduce the_index references to two places:
diff_setup() and fill_textconv().

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoread-cache.c: remove 'const' from index_has_changes()
Nguyễn Thái Ngọc Duy [Fri, 21 Sep 2018 15:57:18 +0000 (17:57 +0200)]
read-cache.c: remove 'const' from index_has_changes()

This function calls do_diff_cache() which eventually needs to set this
"istate" to unpack_options->src_index [1]. This is an unfortunate fact
that unpack_trees() _will_ update [2] src_index so we can't really pass a
const index_state there. Just remove 'const'.

[1] Right now diff_cache() in diff-lib.c assigns the_index to
    src_index. But the plan is to get rid of the_index, so it should
    be 'istate' from here that gets assigned to src_index.

[2] Some transient bits in the source index are touched. Optional
    extensions can also be removed. But other than that the source
    tree should still be valid.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agocompletion: support "git fetch --multiple"
Nguyễn Thái Ngọc Duy [Thu, 20 Sep 2018 16:37:33 +0000 (18:37 +0200)]
completion: support "git fetch --multiple"

When --multiple is given, the remaining arguments are remote names,
not one remote followed by zero or more refspec. Detect this case,
disable refspec completion, and pretend no remote is seen in order to
complete multiple of them.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agogit-describe.1: clarify that "human readable" is also git-readable
Frederick Eaton [Wed, 19 Sep 2018 20:12:31 +0000 (13:12 -0700)]
git-describe.1: clarify that "human readable" is also git-readable

The caption uses the term "human readable", but the DESCRIPTION did
not explain this in context.

Signed-off-by: Frederick Eaton <frederik@ofb.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agogit-column.1: clarify initial description, provide examples
Frederick Eaton [Wed, 19 Sep 2018 20:12:30 +0000 (13:12 -0700)]
git-column.1: clarify initial description, provide examples

When I read this man page I couldn't figure out what kind of input it
was referring to, or how input was being put into columns, or where I
should look for the syntax of the --mode option.

Signed-off-by: Frederick Eaton <frederik@ofb.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agogit-archimport.1: specify what kind of Arch we're talking about
Frederick Eaton [Wed, 19 Sep 2018 20:12:29 +0000 (13:12 -0700)]
git-archimport.1: specify what kind of Arch we're talking about

Is it a CPU architecture? Is it Arch Linux? If you search for "arch
repository", nothing relevant comes up. Let's call it GNU Arch so
people can find it with search engines.

Signed-off-by: Frederick Eaton <frederik@ofb.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoadd: do not accept pathspec magic 'attr'
Nguyễn Thái Ngọc Duy [Tue, 18 Sep 2018 17:31:59 +0000 (19:31 +0200)]
add: do not accept pathspec magic 'attr'

Commit b0db704652 (pathspec: allow querying for attributes -
2017-03-13) adds new pathspec magic 'attr' but only with
match_pathspec(). "git add" has some pathspec related code that still
does not know about 'attr' and will bail out:

    $ git add ':(attr:foo)'
    fatal: BUG:dir.c:1584: unsupported magic 40

A better solution would be making this code support 'attr'. But I
don't know how much work is needed (I'm not familiar with this new
magic). For now, let's simply reject this magic with a friendlier
message:

    $ git add ':(attr:foo)'
    fatal: :(attr:foo): pathspec magic not supported by this command: 'attr'

Update t6135 so that the expected error message is from the
"graceful" rejection codepath, not "oops, we were supposed to reject
the request to trigger this magic" codepath.

Reported-by: smaudet@sebastianaudet.com
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'ab/fetch-tags-noclobber'
Junio C Hamano [Thu, 20 Sep 2018 21:51:43 +0000 (14:51 -0700)]
Merge branch 'ab/fetch-tags-noclobber'

The rules used by "git push" and "git fetch" to determine if a ref
can or cannot be updated were inconsistent; specifically, fetching
to update existing tags were allowed even though tags are supposed
to be unmoving anchoring points.  "git fetch" was taught to forbid
updates to existing tags without the "--force" option.
This is a backward incompatible change but in a good way; it may
still need to be treated carefully.

* ab/fetch-tags-noclobber:
  fetch doc: correct grammar in --force docs
  push doc: add spacing between two words

7 years agoMerge branch 'bp/checkout-new-branch-optim'
Junio C Hamano [Thu, 20 Sep 2018 21:51:43 +0000 (14:51 -0700)]
Merge branch 'bp/checkout-new-branch-optim'

"git checkout -b newbranch [HEAD]" should not have to do as much as
checking out a commit different from HEAD.  An attempt is made to
optimize this special case.

* bp/checkout-new-branch-optim:
  config doc: add missing list separator for checkout.optimizeNewBranch

7 years agomerge-recursive: rename merge_file_1() and merge_content()
Elijah Newren [Wed, 19 Sep 2018 16:14:34 +0000 (09:14 -0700)]
merge-recursive: rename merge_file_1() and merge_content()

Summary:
  merge_file_1()  -> merge_mode_and_contents()
  merge_content() -> handle_content_merge()

merge_file_1() is a very unhelpful name.  Rename it to
merge_mode_and_contents() to reflect what it does.

merge_content() calls merge_mode_and_contents() to do the main part of
its work, but most of this function was about higher level stuff, e.g.
printing out conflict messages, updating skip_worktree bits, checking
for ability to avoid updating the working tree or for D/F conflicts
being in the way, etc.  Since there are several handle_*() functions for
similar levels of checking and handling in merge-recursive.c (e.g.
handle_change_delete(), handle_rename_rename_2to1()), let's rename this
function to handle_content_merge().

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agomerge-recursive: remove final remaining caller of merge_file_one()
Elijah Newren [Wed, 19 Sep 2018 16:14:33 +0000 (09:14 -0700)]
merge-recursive: remove final remaining caller of merge_file_one()

The function names merge_file_one() and merge_file_1() aren't
particularly intuitive function names, especially since there is no
associated merge_file() function that these are related to.  The
previous commit showed that merge_file_one() was prone to be called when
merge_file_1() should be, and since it is just a thin wrapper around
merge_file_1() anyway and only has one caller left, let's just remove
merge_file_one() entirely.

(It also turns out that the one remaining caller of merge_file_one()
has very broken code that needs to be completely rewritten, but that's
the subject of a future patch series; for now, we're just translating
it into a merge_file_1() call.)

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agomerge-recursive: avoid wrapper function when unnecessary and wasteful
Elijah Newren [Wed, 19 Sep 2018 16:14:32 +0000 (09:14 -0700)]
merge-recursive: avoid wrapper function when unnecessary and wasteful

merge_file_one() is a convenience function taking a bunch of oids and
modes, combining each pair into a diff_filespec, and then calling
merge_file_1().  When we already start with diff_filespec's, we can
just call merge_file_1() directly instead of splitting out the oids
and modes for the wrapper to recombine into what we already had.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agomerge-recursive: set paths correctly when three-way merging content
Elijah Newren [Wed, 19 Sep 2018 16:14:31 +0000 (09:14 -0700)]
merge-recursive: set paths correctly when three-way merging content

merge_3way() has code to mark different sides of the conflict with info
about where the content comes from.  If the names of the files involved
match, it simply uses the branch name.  If the names of the files do not
match, it uses branchname:filename.  Unfortunately, merge_content()
previously always called it with one.path = a.path = b.path.  Granted,
it didn't have other path information available to it for years, but
that was corrected by passing rename_conflict_info in commit
3c217c077a86 ("merge-recursive: Provide more info in conflict markers
with file renames", 2011-08-11).  In that commit, instead of just fixing
the bug with the pathnames, it created fake branch names incorporating
both the branch name and file name.

This "fake branch" workaround was extended further when I pulled that
logic out into a special function in commit dac4741554e7
("merge-recursive: Create function for merging with branchname:file
markers", 2011-08-11), and a number of other sites outside of
merge_content() have been added which call into that.  However, this
Rube-Goldberg-esque setup is not merely duplicate code and unnecessary
work, it also risked having other callsites invoke it in a way that
would result in markers of the form branchname:filename:filename (i.e.
with the filename repeated).

Fix this whole mess by:
  - setting one.path, a.path, and b.path appropriately
  - calling merge_file_1() directly
  - deleting the merge_file_special_markers() workaround wrapper

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agogc: fix regression in 7b0f229222 impacting --quiet
Ævar Arnfjörð Bjarmason [Wed, 19 Sep 2018 21:01:38 +0000 (21:01 +0000)]
gc: fix regression in 7b0f229222 impacting --quiet

Fix a regression in my recent 7b0f229222 ("commit-graph write: add
progress output", 2018-09-17).  The newly added progress output for
"commit-graph write" didn't check the --quiet option.

Do so, and add a test asserting that this works as expected. Since the
TTY prequisite isn't available everywhere let's add a version of this
that both requires and doesn't require that. This test might be overly
specific and will break if new progress output is added, but I think
it'll serve as a good reminder to test the undertested progress
mode(s).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Helped-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agogit-config.txt: fix 'see: above' note
Martin Ågren [Wed, 19 Sep 2018 16:38:19 +0000 (18:38 +0200)]
git-config.txt: fix 'see: above' note

Rather than saying "(see: above)", drop the colon. Also drop the comma
before this note.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoDoc: use `--type=bool` instead of `--bool`
Martin Ågren [Wed, 19 Sep 2018 16:38:18 +0000 (18:38 +0200)]
Doc: use `--type=bool` instead of `--bool`

After fb0dc3bac1 (builtin/config.c: support `--type=<type>` as preferred
alias for `--<type>`, 2018-04-18) we have a more modern way of spelling
`--bool`.

Update all instances except those that explicitly document the
"historical options" in git-config.txt. The other old-style
type-specifiers already seem to be gone except for in that list of
historical options.

Tweak the grammar a little in config.txt while we are there.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agodelta-islands.h: add missing forward declarations (hdr-check)
Ramsay Jones [Wed, 19 Sep 2018 00:14:30 +0000 (01:14 +0100)]
delta-islands.h: add missing forward declarations (hdr-check)

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agomidx.h: add missing forward declarations (hdr-check)
Ramsay Jones [Wed, 19 Sep 2018 00:13:36 +0000 (01:13 +0100)]
midx.h: add missing forward declarations (hdr-check)

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorefs/refs-internal.h: add missing declarations (hdr-check)
Ramsay Jones [Wed, 19 Sep 2018 00:12:47 +0000 (01:12 +0100)]
refs/refs-internal.h: add missing declarations (hdr-check)

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorefs/packed-backend.h: add missing declaration (hdr-check)
Ramsay Jones [Wed, 19 Sep 2018 00:11:44 +0000 (01:11 +0100)]
refs/packed-backend.h: add missing declaration (hdr-check)

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorefs/ref-cache.h: add missing declarations (hdr-check)
Ramsay Jones [Wed, 19 Sep 2018 00:10:34 +0000 (01:10 +0100)]
refs/ref-cache.h: add missing declarations (hdr-check)

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoewah/ewok_rlw.h: add missing include (hdr-check)
Ramsay Jones [Wed, 19 Sep 2018 00:09:38 +0000 (01:09 +0100)]
ewah/ewok_rlw.h: add missing include (hdr-check)

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agojson-writer.h: add missing include (hdr-check)
Ramsay Jones [Wed, 19 Sep 2018 00:08:35 +0000 (01:08 +0100)]
json-writer.h: add missing include (hdr-check)

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMakefile: add a hdr-check target
Ramsay Jones [Wed, 19 Sep 2018 00:07:08 +0000 (01:07 +0100)]
Makefile: add a hdr-check target

Commit ef3ca95475 ("Add missing includes and forward declarations",
2018-08-15) resulted from the author employing a manual method to
create a C file consisting of a pair of pre-processor #include
lines (for 'git-compat-util.h' and a given toplevel header), and
fixing any resulting compiler errors or warnings.

Add a Makefile target to automate this process. This implementation
relies on the '-include' and '-xc' arguments to the 'gcc' and 'clang'
compilers, which allows us to effectively create the required C
compilation unit on-the-fly. This limits the portability of this
solution to those systems which have such a compiler.

The new 'hdr-check' target can be used to check most header files in
the project (for various reasons, the 'compat' and 'xdiff' directories
are not included). Also, note that individual header files can be
checked directly using the '.hco' extension (read: Hdr-Check Object)
like so:

    $ make config.hco
        HDR config.h
    $

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agopreload-index: use git_env_bool() not getenv() for customization
Ben Peart [Tue, 18 Sep 2018 23:29:34 +0000 (23:29 +0000)]
preload-index: use git_env_bool() not getenv() for customization

GIT_FORCE_PRELOAD_TEST is only checked for presence by using getenv().
Use git_env_bool() instead so that GIT_FORCE_PRELOAD_TEST=false can
work as expected.

Signed-off-by: Ben Peart <Ben.Peart@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agot/README: correct spelling of "uncommon"
Ben Peart [Tue, 18 Sep 2018 23:29:34 +0000 (23:29 +0000)]
t/README: correct spelling of "uncommon"

Correct a spelling error in the documentation for GIT_TEST_OE_DELTA_SIZE.

Signed-off-by: Ben Peart <Ben.Peart@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agofetch doc: correct grammar in --force docs
Ævar Arnfjörð Bjarmason [Tue, 18 Sep 2018 05:47:39 +0000 (05:47 +0000)]
fetch doc: correct grammar in --force docs

Correct a grammar error (saying "the receiving" made no sense) in the
recently landed documentation added in my 0bc8d71b99 ("fetch: stop
clobbering existing tags without --force", 2018-08-31) by rephrasing
the sentence.  Also correct 'fetching work the same way' by s/work/&s/;

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agopush doc: add spacing between two words
Ævar Arnfjörð Bjarmason [Tue, 18 Sep 2018 05:47:38 +0000 (05:47 +0000)]
push doc: add spacing between two words

Fix a formatting error introduced in my recently landed
fe802bd21e ("push doc: correct lies about how push refspecs work",
2018-08-31).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoconfig doc: add missing list separator for checkout.optimizeNewBranch
Ævar Arnfjörð Bjarmason [Tue, 18 Sep 2018 05:34:49 +0000 (05:34 +0000)]
config doc: add missing list separator for checkout.optimizeNewBranch

The documentation added in fa655d8411 ("checkout: optimize "git
checkout -b <new_branch>"", 2018-08-16) didn't add the double-colon
needed for the labeled list separator, as a result the added
documentation all got squashed into one paragraph. Fix that by adding
the list separator.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agopack-objects: handle island check for "external" delta base
Jeff King [Wed, 19 Sep 2018 03:49:07 +0000 (23:49 -0400)]
pack-objects: handle island check for "external" delta base

Two recent topics, jk/pack-delta-reuse-with-bitmap and
cc/delta-islands, can have a funny interaction. When
checking if we can reuse an on-disk delta, the first topic
allows base_entry to be NULL when we find an object that's
not in the packing list. But the latter topic introduces a
call to in_same_island(), which needs to look at
base_entry->idx.oid. When these two features are used
together, we might try to dereference a NULL base_entry.

In practice, this doesn't really happen. We'd generally only
use delta islands when packing to disk, since the whole
point is to optimize the pack for serving fetches later. And
the new delta-reuse code relies on having used reachability
bitmaps to determine the set of objects, which we would
typically only do when serving an actual fetch.

However, it is technically possible to combine these
features. And even without doing so, building with
"SANITIZE=address,undefined" will cause t5310.46 to
complain.  Even though that test does not have delta islands
enabled, we still take the address of the NULL entry to pass
to in_same_island(). That function then promptly returns
without dereferencing the value when it sees that islands
are not enabled, but it's enough to trigger a sanitizer
error.

The solution is straight-forward: when both features are
used together, we should pass the oid of the found base to
in_same_island().

This is tricky to do inside a single "if" statement. And
after the merge in f3504ea3dd (Merge branch
'cc/delta-islands', 2018-09-17), that "if" condition is
already getting pretty unwieldy. So this patch moves the
logic into a helper function, where we can easily use
multiple return paths. The result is a bit longer, but the
logic should be much easier to follow.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoInitial batch post 2.19
Junio C Hamano [Mon, 17 Sep 2018 21:15:00 +0000 (14:15 -0700)]
Initial batch post 2.19

7 years agoMerge branch 'nd/bisect-show-list-fix'
Junio C Hamano [Mon, 17 Sep 2018 20:54:00 +0000 (13:54 -0700)]
Merge branch 'nd/bisect-show-list-fix'

Debugging aid update.

* nd/bisect-show-list-fix:
  bisect.c: make show_list() build again

7 years agoMerge branch 'ab/fetch-tags-noclobber'
Junio C Hamano [Mon, 17 Sep 2018 20:54:00 +0000 (13:54 -0700)]
Merge branch 'ab/fetch-tags-noclobber'

The rules used by "git push" and "git fetch" to determine if a ref
can or cannot be updated were inconsistent; specifically, fetching
to update existing tags were allowed even though tags are supposed
to be unmoving anchoring points.  "git fetch" was taught to forbid
updates to existing tags without the "--force" option.

* ab/fetch-tags-noclobber:
  fetch: stop clobbering existing tags without --force
  fetch: document local ref updates with/without --force
  push doc: correct lies about how push refspecs work
  push doc: move mention of "tag <tag>" later in the prose
  push doc: remove confusing mention of remote merger
  fetch tests: add a test for clobbering tag behavior
  push tests: use spaces in interpolated string
  push tests: make use of unused $1 in test description
  fetch: change "branch" to "reference" in --force -h output

7 years agoMerge branch 'es/worktree-forced-ops-fix'
Junio C Hamano [Mon, 17 Sep 2018 20:53:59 +0000 (13:53 -0700)]
Merge branch 'es/worktree-forced-ops-fix'

Fix a bug in which the same path could be registered under multiple
worktree entries if the path was missing (for instance, was removed
manually).  Also, as a convenience, expand the number of cases in
which --force is applicable.

* es/worktree-forced-ops-fix:
  doc-diff: force worktree add
  worktree: delete .git/worktrees if empty after 'remove'
  worktree: teach 'remove' to override lock when --force given twice
  worktree: teach 'move' to override lock when --force given twice
  worktree: teach 'add' to respect --force for registered but missing path
  worktree: disallow adding same path multiple times
  worktree: prepare for more checks of whether path can become worktree
  worktree: generalize delete_git_dir() to reduce code duplication
  worktree: move delete_git_dir() earlier in file for upcoming new callers
  worktree: don't die() in library function find_worktree()

7 years agoMerge branch 'sg/doc-trace-appends'
Junio C Hamano [Mon, 17 Sep 2018 20:53:59 +0000 (13:53 -0700)]
Merge branch 'sg/doc-trace-appends'

Docfix.

* sg/doc-trace-appends:
  Documentation/git.txt: clarify that GIT_TRACE=/path appends

7 years agoMerge branch 'jk/diff-rendered-docs'
Junio C Hamano [Mon, 17 Sep 2018 20:53:59 +0000 (13:53 -0700)]
Merge branch 'jk/diff-rendered-docs'

Dev doc update.

* jk/diff-rendered-docs:
  Revert "doc/Makefile: drop doc-diff worktree and temporary files on "make clean""
  doc/Makefile: drop doc-diff worktree and temporary files on "make clean"
  doc-diff: add --clean mode to remove temporary working gunk
  doc-diff: fix non-portable 'man' invocation
  doc-diff: always use oids inside worktree
  SubmittingPatches: mention doc-diff

7 years agoMerge branch 'jk/patch-corrupted-delta-fix'
Junio C Hamano [Mon, 17 Sep 2018 20:53:58 +0000 (13:53 -0700)]
Merge branch 'jk/patch-corrupted-delta-fix'

Malformed or crafted data in packstream can make our code attempt
to read or write past the allocated buffer and abort, instead of
reporting an error, which has been fixed.

* jk/patch-corrupted-delta-fix:
  t5303: use printf to generate delta bases
  patch-delta: handle truncated copy parameters
  patch-delta: consistently report corruption
  patch-delta: fix oob read
  t5303: test some corrupt deltas
  test-delta: read input into a heap buffer

7 years agoMerge branch 'ds/commit-graph-tests'
Junio C Hamano [Mon, 17 Sep 2018 20:53:58 +0000 (13:53 -0700)]
Merge branch 'ds/commit-graph-tests'

We can now optionally run tests with commit-graph enabled.

* ds/commit-graph-tests:
  commit-graph: define GIT_TEST_COMMIT_GRAPH

7 years agoMerge branch 'jk/pack-objects-with-bitmap-fix'
Junio C Hamano [Mon, 17 Sep 2018 20:53:58 +0000 (13:53 -0700)]
Merge branch 'jk/pack-objects-with-bitmap-fix'

Hotfix of the base topic.

* jk/pack-objects-with-bitmap-fix:
  pack-bitmap: drop "loaded" flag
  traverse_bitmap_commit_list(): don't free result
  t5310: test delta reuse with bitmaps
  bitmap_has_sha1_in_uninteresting(): drop BUG check

7 years agoMerge branch 'rs/mailinfo-format-flowed'
Junio C Hamano [Mon, 17 Sep 2018 20:53:57 +0000 (13:53 -0700)]
Merge branch 'rs/mailinfo-format-flowed'

"git mailinfo" used in "git am" learned to make a best-effort
recovery of a patch corrupted by MUA that sends text/plain with
format=flawed option.

* rs/mailinfo-format-flowed:
  mailinfo: support format=flowed

7 years agoMerge branch 'jk/cocci'
Junio C Hamano [Mon, 17 Sep 2018 20:53:57 +0000 (13:53 -0700)]
Merge branch 'jk/cocci'

spatch transformation to replace boolean uses of !hashcmp() to
newly introduced oideq() is added, and applied, to regain
performance lost due to support of multiple hash algorithms.

* jk/cocci:
  show_dirstat: simplify same-content check
  read-cache: use oideq() in ce_compare functions
  convert hashmap comparison functions to oideq()
  convert "hashcmp() != 0" to "!hasheq()"
  convert "oidcmp() != 0" to "!oideq()"
  convert "hashcmp() == 0" to hasheq()
  convert "oidcmp() == 0" to oideq()
  introduce hasheq() and oideq()
  coccinelle: use <...> for function exclusion

7 years agoMerge branch 'tg/rerere-doc-updates'
Junio C Hamano [Mon, 17 Sep 2018 20:53:56 +0000 (13:53 -0700)]
Merge branch 'tg/rerere-doc-updates'

Clarify a part of technical documentation for rerere.

* tg/rerere-doc-updates:
  rerere: add note about files with existing conflict markers
  rerere: mention caveat about unmatched conflict markers

7 years agoMerge branch 'es/format-patch-rangediff'
Junio C Hamano [Mon, 17 Sep 2018 20:53:56 +0000 (13:53 -0700)]
Merge branch 'es/format-patch-rangediff'

"git format-patch" learned a new "--range-diff" option to explain
the difference between this version and the previous attempt in
the cover letter (or after the tree-dashes as a comment).

* es/format-patch-rangediff:
  format-patch: allow --range-diff to apply to a lone-patch
  format-patch: add --creation-factor tweak for --range-diff
  format-patch: teach --range-diff to respect -v/--reroll-count
  format-patch: extend --range-diff to accept revision range
  format-patch: add --range-diff option to embed diff in cover letter
  range-diff: relieve callers of low-level configuration burden
  range-diff: publish default creation factor
  range-diff: respect diff_option.file rather than assuming 'stdout'