]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
3 years agot642[23]: be more flexible for add/add conflicts involving pair renames
Elijah Newren [Mon, 10 Aug 2020 22:29:18 +0000 (22:29 +0000)] 
t642[23]: be more flexible for add/add conflicts involving pair renames

Much like the last commit accepted 'add/add' and 'rename/add'
interchangably, we also want to do the same for 'add/add' and
'rename/rename'.  This also allows us to avoid the ambiguity in meaning
with 'rename/rename' (is it two separate files renamed to the same
location, or one file renamed on both sides but differently)?

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot6422, t6426: be more flexible for add/add conflicts involving renames
Elijah Newren [Mon, 10 Aug 2020 22:29:17 +0000 (22:29 +0000)] 
t6422, t6426: be more flexible for add/add conflicts involving renames

merge-recursive treats an add/add conflict where one of the adds came
from a rename as a separate 'rename/add' type of conflict.  However, if
there is not content conflict after the content merge(s), then the file
is not considered to be conflicted.  That suggests the conflict type is
really just add/add.  Other merge engines might choose to print messages
to the console that just refer to these as add/add conflicts; accept
both types of output.

Note: it could help to notify users if the three-way content merge of
the rename had content conflicts, because when we then go to two-way
merge THAT with the conflicting add we can get nested conflict markers.
merge-recursive, unfortunately, doesn't do that, but other merge engines
could.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot6423: add an explanation about why one of the tests does not pass
Elijah Newren [Mon, 10 Aug 2020 22:29:16 +0000 (22:29 +0000)] 
t6423: add an explanation about why one of the tests does not pass

I had long since forgotten the idea behind this test and why it failed,
and took a little while to figure it out.  To prevent others from having
to spend a similar time on it, add an explanation in the comments.
However, the reasoning in the explanation makes me question why I
considered it a failure at all.  I'm not sure if I had a better reason
when I originally wrote it, but for now just add commentary about the
possible expectations and why it behaves the way it does right now.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot6416, t6423: clarify some comments and fix some typos
Elijah Newren [Mon, 10 Aug 2020 22:29:15 +0000 (22:29 +0000)] 
t6416, t6423: clarify some comments and fix some typos

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot6422: fix multiple errors with the mod6 test expectations
Elijah Newren [Mon, 10 Aug 2020 22:29:14 +0000 (22:29 +0000)] 
t6422: fix multiple errors with the mod6 test expectations

This test had multiple issues causing it to fail for the wrong
reason(s):

  * rename/rename(1to2) conflicts have always left the original source
    path present in the working directory and index (at stage 1).  Thus,
    the triple rename/rename(1to2) should result in 9 unstaged files,
    not 6.
  * It messed up the three-way content merge for checking the results of
    merging for one of the renames, accidentally turning it into a
    two-way merge.
  * It got the contents of the base files it was using to compare
    against wrong, due to an off-by-one error, and overwrite-redirection
    ('>') instead of append-redirection ('>>').
  * It used slightly too-long conflict markers
  * It didn't include filenames in the conflict marker hunks (granted,
    that was a shortcoming of the merge-recursive backend for rename/add
    and rename/rename(2to1) conflicts, but since it's
    test_expect_failure anyway we might as well make it expect our
    preferred behavior rather than some compromise that we can't yet
    reach anyway).

Fix these issues so that a merge backend which correctly handles these
kinds of nested conflicts will pass the test.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot6423: fix test setup for a couple tests
Elijah Newren [Mon, 10 Aug 2020 22:29:13 +0000 (22:29 +0000)] 
t6423: fix test setup for a couple tests

Commit da1e295e00 ("t604[236]: do not run setup in separate tests",
2019-10-22) removed approximately half the tests (which were setup-only
tests) in t6043 by turning them into functions that the subsequent test
would call as their first step.  This ensured that any test from this
file could be run entirely independently of all the other tests in the
file.  Unfortunately, the call to the new setup function was missed in
two of the test_expect_failure cases.  Add them in.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot6416, t6422: fix incorrect untracked file count
Elijah Newren [Mon, 10 Aug 2020 22:29:12 +0000 (22:29 +0000)] 
t6416, t6422: fix incorrect untracked file count

Apparently I don't know how to count untracked files, and since the
tests in question were marked as test_expect_failure, no one ever
noticed it until now.  Correct the count, as these tests clearly create
three untracked files ('out', 'err', and 'file_count').

(I believe this problem arose because earlier incarnations counted lines
via a pipe to 'wc -l'.  Reviewers asked that it be replaced by writing
the output to a file and using test_line_count, but when the temporary
output was added to a separate file, the count of untracked files should
have increased.)

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot6422: fix bad check against missing file
Elijah Newren [Mon, 10 Aug 2020 22:29:11 +0000 (22:29 +0000)] 
t6422: fix bad check against missing file

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot6418: tighten delete/normalize conflict testcase
Elijah Newren [Mon, 10 Aug 2020 22:29:10 +0000 (22:29 +0000)] 
t6418: tighten delete/normalize conflict testcase

The testcase only required that the merge complete without conflict,
without specifying what the correct resolution was.  Since normalization
changed this from a modify/delete to a not-modified/delete, the correct
resolution is to have the file be removed at the end.  Add a check for
this resolution.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoCollect merge-related tests to t64xx
Elijah Newren [Mon, 10 Aug 2020 22:29:09 +0000 (22:29 +0000)] 
Collect merge-related tests to t64xx

The tests for the merge machinery are spread over several places.
Collect them into t64xx for simplicity.  Some notes:

t60[234]*.sh:
  Merge tests started in t602*, overgrew bisect and remote tracking
  tests in t6030, t6040, and t6041, and nearly overtook replace tests
  in t6050.  This made picking out relevant tests that I wanted to run
  in a tighter loop slightly more annoying for years.

t303*.sh:
  These started out as tests for the 'merge-recursive' toplevel command,
  but did not restrict to that and had lots of overlap with the
  underlying merge machinery.
t7405, t7613:
  submodule-specific merge logic started out in submodule.c but was
  moved to merge-recursive.c in commit 18cfc08866 ("submodule.c: move
  submodule merging to merge-recursive.c", 2018-05-15).  Since these
  tests are about the logic found in the merge machinery, moving these
  tests to be with the merge tests makes sense.

t7607, t7609:
  Having tests spread all over the place makes it more likely that
  additional tests related to a certain piece of logic grow in all those
  other places.  Much like t303*.sh, these two tests were about the
  underlying merge machinery rather than outer levels.

Tests that were NOT moved:

t76[01]*.sh:
  Other than the four tests mentioned above, the remaining tests in
  t76[01]*.sh are related to non-recursive merge strategies, parameter
  parsing, and other stuff associated with the highlevel builtin/merge.c
  rather than the recursive merge machinery.

t3[45]*.sh:
  The rebase testcases in t34*.sh also test the merge logic pretty
  heavily; sometimes changes I make only trigger failures in the rebase
  tests.  The rebase tests are already nicely coupled together, though,
  and I didn't want to mess that up.  Similar comments apply for the
  cherry-pick tests in t35*.sh.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoFifth batch
Junio C Hamano [Mon, 10 Aug 2020 17:11:52 +0000 (10:11 -0700)] 
Fifth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'pb/guide-docs'
Junio C Hamano [Mon, 10 Aug 2020 17:24:04 +0000 (10:24 -0700)] 
Merge branch 'pb/guide-docs'

Update "git help guides" documentation organization.

* pb/guide-docs:
  git.txt: add list of guides
  Documentation: don't hardcode command categories twice
  help: drop usage of 'common' and 'useful' for guides
  command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers'

3 years agoMerge branch 'so/rev-parser-errormessage-fix'
Junio C Hamano [Mon, 10 Aug 2020 17:24:03 +0000 (10:24 -0700)] 
Merge branch 'so/rev-parser-errormessage-fix'

Error message fix.

* so/rev-parser-errormessage-fix:
  revision: fix die() message for "--unpacked="

3 years agoMerge branch 'en/eol-attrs-gotchas'
Junio C Hamano [Mon, 10 Aug 2020 17:24:02 +0000 (10:24 -0700)] 
Merge branch 'en/eol-attrs-gotchas'

All "mergy" operations that internally use the merge-recursive
machinery should honor the merge.renormalize configuration, but
many of them didn't.

* en/eol-attrs-gotchas:
  checkout: support renormalization with checkout -m <paths>
  merge: make merge.renormalize work for all uses of merge machinery
  t6038: remove problematic test
  t6038: make tests fail for the right reason

3 years agoMerge branch 'jk/compiler-fixes-and-workarounds'
Junio C Hamano [Mon, 10 Aug 2020 17:24:02 +0000 (10:24 -0700)] 
Merge branch 'jk/compiler-fixes-and-workarounds'

Small fixes and workarounds.

* jk/compiler-fixes-and-workarounds:
  revision: avoid leak when preparing bloom filter for "/"
  revision: avoid out-of-bounds read/write on empty pathspec
  config: work around gcc-10 -Wstringop-overflow warning

3 years agoMerge branch 'ny/notes-doc-sample-update'
Junio C Hamano [Mon, 10 Aug 2020 17:24:02 +0000 (10:24 -0700)] 
Merge branch 'ny/notes-doc-sample-update'

Doc updates.

* ny/notes-doc-sample-update:
  docs: improve the example that illustrates git-notes path names

3 years agoMerge branch 'es/adjust-subtree-test-for-merge-msg-update'
Junio C Hamano [Mon, 10 Aug 2020 17:24:01 +0000 (10:24 -0700)] 
Merge branch 'es/adjust-subtree-test-for-merge-msg-update'

Adjust tests in contrib/ to the recent change to fmt-merge-msg.

* es/adjust-subtree-test-for-merge-msg-update:
  Revert "contrib: subtree: adjust test to change in fmt-merge-msg"

3 years agoMerge branch 'rs/bisect-oid-to-hex-fix'
Junio C Hamano [Mon, 10 Aug 2020 17:24:01 +0000 (10:24 -0700)] 
Merge branch 'rs/bisect-oid-to-hex-fix'

Code cleanup.

* rs/bisect-oid-to-hex-fix:
  bisect: use oid_to_hex_r() instead of memcpy()+oid_to_hex()

3 years agoMerge branch 'en/merge-recursive-comment-fixes'
Junio C Hamano [Mon, 10 Aug 2020 17:24:00 +0000 (10:24 -0700)] 
Merge branch 'en/merge-recursive-comment-fixes'

Comment fix.

* en/merge-recursive-comment-fixes:
  merge-recursive: fix unclear and outright wrong comments

3 years agoMerge branch 'ma/t1450-quotefix'
Junio C Hamano [Mon, 10 Aug 2020 17:23:59 +0000 (10:23 -0700)] 
Merge branch 'ma/t1450-quotefix'

Test fix.

* ma/t1450-quotefix:
  t1450: fix quoting of NUL byte when corrupting pack

3 years agoMerge branch 'es/worktree-cleanup'
Junio C Hamano [Mon, 10 Aug 2020 17:23:58 +0000 (10:23 -0700)] 
Merge branch 'es/worktree-cleanup'

Code cleanup around "worktree" API implementation.

* es/worktree-cleanup:
  worktree: retire special-case normalization of main worktree path
  worktree: drop bogus and unnecessary path munging
  worktree: drop unused code from get_linked_worktree()
  worktree: drop pointless strbuf_release()

3 years agoMerge branch 'jk/strvec'
Junio C Hamano [Mon, 10 Aug 2020 17:23:57 +0000 (10:23 -0700)] 
Merge branch 'jk/strvec'

The argv_array API is useful for not just managing argv but any
"vector" (NULL-terminated array) of strings, and has seen adoption
to a certain degree.  It has been renamed to "strvec" to reduce the
barrier to adoption.

* jk/strvec:
  strvec: rename struct fields
  strvec: drop argv_array compatibility layer
  strvec: update documention to avoid argv_array
  strvec: fix indentation in renamed calls
  strvec: convert remaining callers away from argv_array name
  strvec: convert more callers away from argv_array name
  strvec: convert builtin/ callers away from argv_array name
  quote: rename sq_dequote_to_argv_array to mention strvec
  strvec: rename files from argv-array to strvec
  argv-array: rename to strvec
  argv-array: use size_t for count and alloc

3 years agogit.txt: add list of guides
Philippe Blain [Wed, 5 Aug 2020 01:19:07 +0000 (01:19 +0000)] 
git.txt: add list of guides

Not all man5/man7 guides are mentioned in the 'git(1)' documentation,
which makes the missing ones somewhat hard to find.

Add a list of the guides to git(1) by leveraging the existing
`Documentation/cmd-list.perl` script to generate a file `cmds-guide.txt`
which gets included in git.txt.

Also, do not hard-code the manual section '1'. Instead, use a regex so
that the manual section is discovered from the first line of each
`git*.txt` file.

This addition was hinted at in 1b81d8cb19 (help: use command-list.txt
for the source of guides, 2018-05-20).

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoDocumentation: don't hardcode command categories twice
Junio C Hamano [Wed, 5 Aug 2020 01:19:06 +0000 (01:19 +0000)] 
Documentation: don't hardcode command categories twice

Instead of hard-coding the list of command categories in both
`Documentation/Makefile` and `Documentation/cmd-list.perl`, make the
Makefile the authoritative source and tweak `cmd-list.perl` so that it
receives the list of command categories as argument.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agohelp: drop usage of 'common' and 'useful' for guides
Philippe Blain [Wed, 5 Aug 2020 01:19:05 +0000 (01:19 +0000)] 
help: drop usage of 'common' and 'useful' for guides

Since 1b81d8cb19 (help: use command-list.txt for the source of guides,
2018-05-20), all man5/man7 guides listed in command-list.txt appear in
the output of 'git help -g'.

However, 'git help -g' still prefixes this list with "The common Git
guides are:", which makes one wonder if there are others!

In the same spirit, the man page for 'git help' describes the '--guides'
option as listing 'useful' guides, which is not false per se but can
also be taken to mean that there are other guides that exist but are not
useful.

Instead of 'common' and 'useful', use 'Git concept guides' in both
places. To keep the code in line with this change, rename
help.c::list_common_guides_help to list_guides_help.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocommand-list.txt: add missing 'gitcredentials' and 'gitremote-helpers'
Philippe Blain [Wed, 5 Aug 2020 01:19:04 +0000 (01:19 +0000)] 
command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers'

The guides 'gitcredentials' and 'gitremote-helpers' do not currently
appear in command-list.txt.

'gitcredentials' was forgotten back when guides were added to
command-list.txt in 1b81d8cb19 (help: use command-list.txt for the
source of guides, 2018-05-20).

'gitremote-helpers' was moved to section 7 in 439cc74632 (docs: move
gitremote-helpers into section 7, 2019-03-25), but command-list.txt was
not updated at the time.

Add these two guides to the list of guides in 'command-list.txt', so
that they appear in the output of 'git help --guides', and capitalize
the first word of the description of 'gitcredentials', as was done in
1b81d8c (help: use command-list.txt for the source of guides,
2018-05-20) for the other guides.

While at it, add a comment in Documentation/Makefile to remind developers
to update command-list.txt if they add a new guide.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agorevision: fix die() message for "--unpacked="
Sergey Organov [Tue, 4 Aug 2020 22:26:30 +0000 (01:26 +0300)] 
revision: fix die() message for "--unpacked="

Get rid of the trailing dot and mark for translation.

Signed-off-by: Sergey Organov <sorganov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoFourth batch
Junio C Hamano [Tue, 4 Aug 2020 20:53:36 +0000 (13:53 -0700)] 
Fourth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'jt/pretend-object-never-come-from-elsewhere'
Junio C Hamano [Tue, 4 Aug 2020 20:53:58 +0000 (13:53 -0700)] 
Merge branch 'jt/pretend-object-never-come-from-elsewhere'

The pretend-object mechanism checks if the given object already
exists in the object store before deciding to keep the data
in-core, but the check would have triggered lazy fetching of such
an object from a promissor remote.

* jt/pretend-object-never-come-from-elsewhere:
  sha1-file: make pretend_object_file() not prefetch

3 years agoMerge branch 'jt/pack-objects-prefetch-in-batch'
Junio C Hamano [Tue, 4 Aug 2020 20:53:57 +0000 (13:53 -0700)] 
Merge branch 'jt/pack-objects-prefetch-in-batch'

While packing many objects in a repository with a promissor remote,
lazily fetching missing objects from the promissor remote one by
one may be inefficient---the code now attempts to fetch all the
missing objects in batch (obviously this won't work for a lazy
clone that lazily fetches tree objects as you cannot even enumerate
what blobs are missing until you learn which trees are missing).

* jt/pack-objects-prefetch-in-batch:
  pack-objects: prefetch objects to be packed
  pack-objects: refactor to oid_object_info_extended

3 years agoMerge branch 'mp/complete-show-color-moved'
Junio C Hamano [Tue, 4 Aug 2020 20:53:56 +0000 (13:53 -0700)] 
Merge branch 'mp/complete-show-color-moved'

Command line completion (in contrib/) update.

* mp/complete-show-color-moved:
  completion: add show --color-moved[-ws]

3 years agorevision: avoid leak when preparing bloom filter for "/"
Jeff King [Tue, 4 Aug 2020 07:50:17 +0000 (03:50 -0400)] 
revision: avoid leak when preparing bloom filter for "/"

If we're given an empty pathspec, we refuse to set up bloom filters, as
described in f3c2a36810 (revision: empty pathspecs should not use Bloom
filters, 2020-07-01).

But before the empty string check, we drop any trailing slash by
allocating a new string without it. So a pathspec consisting only of "/"
will allocate that string, but then still cause us to bail, leaking the
new string. Let's make sure to free it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agorevision: avoid out-of-bounds read/write on empty pathspec
Jeff King [Tue, 4 Aug 2020 07:46:52 +0000 (03:46 -0400)] 
revision: avoid out-of-bounds read/write on empty pathspec

Running t4216 with ASan results in it complaining of an out-of-bounds
read in prepare_to_use_bloom_filter(). The issue is this code to strip a
trailing slash:

  last_index = pi->len - 1;
  if (pi->match[last_index] == '/') {

because we have no guarantee that pi->len isn't zero. This can happen if
the pathspec is ".", as we translate that to an empty string. And if
that read of random memory does trigger the conditional, we'd then do an
out-of-bounds write:

  path_alloc = xstrdup(pi->match);
  path_alloc[last_index] = '\0';

Let's make sure to check the length before subtracting. Note that for an
empty pathspec, we'd end up bailing from the function a few lines later,
which makes it tempting to just:

  if (!pi->len)
          return;

early here. But our code here is stripping a trailing slash, and we need
to check for emptiness after stripping that slash, too. So we'd have two
blocks, which would require repeating some cleanup code.

Instead, just skip the trailing-slash for an empty string. Setting
last_index at all in the case is awkward since it will have a nonsense
value (and it uses an "int", which is a too-small type for a string
anyway). So while we're here, let's:

  - drop last_index entirely; it's only used in two spots right next to
    each other and writing out "pi->len - 1" in both is actually easier
    to follow

  - use xmemdupz() to duplicate the string. This is slightly more
    efficient, but more importantly makes the intent more clear by
    allocating the correct-sized substring in the first place. It also
    eliminates any question of whether path_alloc is as long as
    pi->match (which it would not be if pi->match has any embedded NULs,
    though in practice this is probably impossible).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoconfig: work around gcc-10 -Wstringop-overflow warning
Jeff King [Tue, 4 Aug 2020 07:43:53 +0000 (03:43 -0400)] 
config: work around gcc-10 -Wstringop-overflow warning

Compiling with gcc-10, -O2, and -fsanitize=undefined results in a
compiler warning:

  config.c: In function ‘git_config_copy_or_rename_section_in_file’:
  config.c:3170:17: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
   3170 |       output[0] = '\t';
        |       ~~~~~~~~~~^~~~~~
  config.c:3076:7: note: at offset -1 to object ‘buf’ with size 1024 declared here
   3076 |  char buf[1024];
        |       ^~~

This is a false positive. The interesting lines of code are:

  int i;
  char *output = buf;
  ...
  for (i = 0; buf[i] && isspace(buf[i]); i++)
          ; /* do nothing */
  ...
  int offset;
  offset = section_name_match(&buf[i], old_name);
  if (offset > 0) {
          ...
          output += offset + i;
          if (strlen(output) > 0) {
  /*
   * More content means there's
   * a declaration to put on the
   * next line; indent with a
   * tab
   */
  output -= 1;
  output[0] = '\t';
  }
  }

So we do assign output to buf initially. Later we increment it based on
"offset" and "i" and then subtract "1" from it. That latter step is what
the compiler is complaining about; it could lead to going off the left
side of the array if "output == buf" at the moment of the subtraction.
For that to be the case, then "offset + i" would have to be 0. But that
can't happen:

  - we know that "offset" is at least 1, since we're in a conditional
    block that checks that

  - we know that "i" is not negative, since it started at 0 and only
    incremented over whitespace

So the sum must be at least 1, and therefore it's OK to subtract one
from "output".

But that's not quite the whole story. Since "i" is an int, it could in
theory be possible to overflow to negative (when counting whitespace on
a very large string). But we know that's impossible because we're
counting the 1024-byte buffer we just fed to fgets(), so it can never be
larger than that.

Switching the type of "i" to "unsigned" makes the warning go away, so
let's do that.

Arguably size_t is an even better type (for this and for the other
length fields), but switching to it produces a similar but distinct
warning:

  config.c: In function ‘git_config_copy_or_rename_section_in_file’:
  config.c:3170:13: error: array subscript -1 is outside array bounds of ‘char[1024]’ [-Werror=array-bounds]
   3170 |       output[0] = '\t';
        |       ~~~~~~^~~
  config.c:3076:7: note: while referencing ‘buf’
   3076 |  char buf[1024];
        |       ^~~

If we were to ever switch off of fgets() to strbuf_getline() or similar,
we'd probably need to use size_t to avoid other overflow problems. But
for now we know we're safe because of the small fixed size of our
buffer.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoRevert "contrib: subtree: adjust test to change in fmt-merge-msg"
Emily Shaffer [Mon, 3 Aug 2020 18:57:49 +0000 (11:57 -0700)] 
Revert "contrib: subtree: adjust test to change in fmt-merge-msg"

This reverts commit 508fd8e8baf3e18ee40b2cf0b8899188a8506d07.

In 6e6029a8 (fmt-merge-msg: allow merge destination to be omitted again)
we get back the behavior where merges against 'master', by default, do
not include "into 'master'" at the end of the merge message. This test
fix is no longer needed.

Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agodocs: improve the example that illustrates git-notes path names
Noam Yorav-Raphael [Mon, 3 Aug 2020 19:10:15 +0000 (19:10 +0000)] 
docs: improve the example that illustrates git-notes path names

Make it clear that the filename has only the rest of the object ID,
not the entirety of it.

Signed-off-by: Noam Yorav-Raphael <noamraph@gmail.com>
Acked-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocheckout: support renormalization with checkout -m <paths>
Elijah Newren [Mon, 3 Aug 2020 18:41:20 +0000 (18:41 +0000)] 
checkout: support renormalization with checkout -m <paths>

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agomerge: make merge.renormalize work for all uses of merge machinery
Elijah Newren [Mon, 3 Aug 2020 18:41:19 +0000 (18:41 +0000)] 
merge: make merge.renormalize work for all uses of merge machinery

The 'merge' command is not the only one that does merges; other commands
like checkout -m or rebase do as well.  Unfortunately, the only area of
the code that checked for the "merge.renormalize" config setting was in
builtin/merge.c, meaning it could only affect merges performed by the
"merge" command.  Move the handling of this config setting to
merge_recursive_config() so that other commands can benefit from it as
well.  Fixes a few tests in t6038.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot6038: remove problematic test
Elijah Newren [Mon, 3 Aug 2020 18:41:18 +0000 (18:41 +0000)] 
t6038: remove problematic test

t6038.11, 'cherry-pick patch from after text=auto' was a test of
undefined behavior.  To make matters worse, while there are a couple
possible correct answers, this test was coded to only check for an
obviously incorrect answer.  And the final cherry on top is that the
test is marked test_expect_failure, meaning it can't provide much value,
other than possibly confusing future folks who come along and try to
work on attributes and look at existing tests.  Because of all these
problems, just remove the test.

But for any future code spelunkers, here's my understanding of the two
possible correct answers:

This test was set up so that on a branch with no .gitattributes file,
you cherry-picked a patch from a branch that had a .gitattributes file
(containing '* text=auto').  Further, the two branches had a file which
differed only in line endings.  In this situation, correct behavior is
not well defined: should the .gitattributes file affect the merge or
not?

If the .gitattributes file on the other branch should not affect the
merge, then we would have a content conflict with all three stages
different (the merge base didn't match either side).

If the .gitattributes file from the other branch should affect the
merge, then we would expect the line endings to be normalized to LF for
the version to be recorded in the repository.  This would mean that when
doing a three-way content merge on the file that differed in line
endings, that the three-way content merge would see that the versions on
both sides matched and so the cherry-pick has no conflicts and can
succeed.  The line endings in the file as recorded in the repository
will change from CRLF to LF.  The version checked out in the working
copy will depend on the platform (since there's no eol attribute defined
for the file).

Also, as a final side note, this test expected an error message that was
built assuming cherry-pick was the old scripted version, because
cherry-pick no longer uses the error message that was encoded in this
test.  So it was wrong for yet another reason.

Given that the handling of .gitattributes is not well defined and this
test was obviously broken and could do nothing but confuse future
readers, just remove it.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot6038: make tests fail for the right reason
Elijah Newren [Mon, 3 Aug 2020 18:41:17 +0000 (18:41 +0000)] 
t6038: make tests fail for the right reason

t6038 had a pair of tests that were expected to fail, but weren't
failing for the expected reason.  Both were meant to do a merge that
could be done cleanly after renormalization, but were supposed to fail
for lack of renormalization.  Unfortunately, both tests had staged
changes, and checkout -m would abort due to the presence of those staged
changes before even attempting a merge.

Fix this first issue by utilizing git-restore instead of git-checkout,
so that the index is left alone and just the working directory gets the
changes we want.

However, there is a second issue with these tests.  Technically, they
just wanted to verify that after renormalization, no conflicts would be
present.  This could have been checked for by grepping for a lack of
conflict markers, but the test instead tried to compare the working
directory files to an expected result.  Unfortunately, the setting of
"text=auto" without setting core.eol to any value meant that the content
of the file (in particular, the line endings) would be
platform-dependent and the tests could only pass on some platforms.
Replace the existing comparison with a call to 'git diff --no-index
--ignore-cr-at-eol' to verify that the contents, other than possible
carriage returns in the file, match the expected results and in
particular that the file has no conflicts from the checkout -m
operation.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agobisect: use oid_to_hex_r() instead of memcpy()+oid_to_hex()
René Scharfe [Sun, 2 Aug 2020 14:36:50 +0000 (16:36 +0200)] 
bisect: use oid_to_hex_r() instead of memcpy()+oid_to_hex()

Write the hexadecimal object ID directly into the destination buffer
using oid_to_hex_r() instead of writing it into a static buffer first
using oid_to_hex() and then copying it from there using memcpy().
This is shorter, simpler and a bit more efficient.

Reviewed-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agomerge-recursive: fix unclear and outright wrong comments
Elijah Newren [Sun, 2 Aug 2020 03:14:27 +0000 (03:14 +0000)] 
merge-recursive: fix unclear and outright wrong comments

Commits 7c0a6c8e47 ("merge-recursive: move some definitions around to
clean up the header", 2019-08-17), and b4db8a2b76 ("merge-recursive:
remove useless parameter in merge_trees()", 2019-08-17) added some
useful documentation to the functions, but had a few places where the
new comments were unclear or even misleading.  Fix those comments.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot1450: fix quoting of NUL byte when corrupting pack
Martin Ågren [Sat, 1 Aug 2020 22:06:11 +0000 (00:06 +0200)] 
t1450: fix quoting of NUL byte when corrupting pack

We use

  printf '\0'

to generate a NUL byte which we then `dd` into the packfile to ensure
that we modify the first byte of the first object, thereby
(probabilistically) invalidating the checksum. Except the single quotes
we're using are interpreted to match with the ones we enclose the whole
test in. So we actually execute

  printf \0

and end up injecting the ASCII code for "0", 0x30, instead.

The comment right above this `printf` invocation says that "at least one
of [the type bits] is not zero, so setting the first byte to 0 is
sufficient". Substituting "0x30" for "0" in that comment won't do: we'd
need to reason about which bits go where and just what the packfile
looks like that we're modifying in this test.

Let's avoid all of that by actually executing

  printf "\0"

to generate a NUL byte, as intended.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoThird batch
Junio C Hamano [Sat, 1 Aug 2020 20:46:41 +0000 (13:46 -0700)] 
Third batch

A couple of brown-paper-bag fixes, plus the other "The branch
'master' no longer is special" fix.

Now we are ready to rewind 'next'.

3 years agoMerge branch 'cc/pretty-contents-size' into master
Junio C Hamano [Sat, 1 Aug 2020 20:49:14 +0000 (13:49 -0700)] 
Merge branch 'cc/pretty-contents-size' into master

Brown-paper-bag fix.

* cc/pretty-contents-size:
  t6300: fix issues related to %(contents:size)

3 years agoMerge branch 'hn/reftable' into master
Junio C Hamano [Sat, 1 Aug 2020 20:49:13 +0000 (13:49 -0700)] 
Merge branch 'hn/reftable' into master

Brown-paper-bag fix.

* hn/reftable:
  refs: move the logic to add \t to reflog to the files backend

3 years agoMerge branch 'jc/fmt-merge-msg-suppress-destination' into master
Junio C Hamano [Sat, 1 Aug 2020 20:49:12 +0000 (13:49 -0700)] 
Merge branch 'jc/fmt-merge-msg-suppress-destination' into master

"git merge" learned to selectively omit " into <branch>" at the end
of the title of default merge message with merge.suppressDest
configuration.

* jc/fmt-merge-msg-suppress-destination:
  fmt-merge-msg: allow merge destination to be omitted again
  Revert "fmt-merge-msg: stop treating `master` specially"

3 years agoworktree: retire special-case normalization of main worktree path
Eric Sunshine [Fri, 31 Jul 2020 23:32:14 +0000 (19:32 -0400)] 
worktree: retire special-case normalization of main worktree path

In order for "git-worktree list" to present consistent results,
get_main_worktree() performs manual normalization on the repository
path (returned by get_common_dir()) after passing it through
strbuf_add_absolute_path(). In particular, it cleans up the path for
three distinct cases when the current working directory is (1) the main
worktree, (2) the .git/ subdirectory, or (3) a bare repository.

The need for such special-cases is a direct consequence of employing
strbuf_add_absolute_path() which, for the sake of efficiency, doesn't
bother normalizing the path (such as folding out redundant path
components) after making it absolute. Lack of normalization is not
typically a problem since redundant path elements make no difference
when working with paths at the filesystem level. However, when preparing
paths for presentation, possible redundant path components make it
difficult to ensure consistency.

Eliminate the need for these special cases by instead making the path
absolute via strbuf_add_real_path() which normalizes the path for us.
Once normalized, the only case we need to handle manually is converting
it to the path of the main worktree by stripping the "/.git" suffix.
This stripping of the "/.git" suffix is a regular idiom in
worktree-related code; for instance, it is employed by
get_linked_worktree(), as well.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoworktree: drop bogus and unnecessary path munging
Eric Sunshine [Fri, 31 Jul 2020 23:32:13 +0000 (19:32 -0400)] 
worktree: drop bogus and unnecessary path munging

The content of .git/worktrees/<id>/gitdir must be a path of the form
"/path/to/worktree/.git". Any other content would be indicative of a
corrupt "gitdir" file. To determine the path of the worktree itself one
merely strips the "/.git" suffix, and this is indeed how the worktree
path was determined from inception.

However, 5193490442 (worktree: add a function to get worktree details,
2015-10-08) extended the path manipulation in a mysterious way. If it is
unable to strip "/.git" from the path, then it instead reports the
current working directory as the linked worktree's path:

    if (!strbuf_strip_suffix(&worktree_path, "/.git")) {
        strbuf_reset(&worktree_path);
        strbuf_add_absolute_path(&worktree_path, ".");
        strbuf_strip_suffix(&worktree_path, "/.");
    }

This logic is clearly bogus; it can never be generally correct behavior.
It materialized out of thin air in 5193490442 with neither explanation
nor tests to illustrate a case in which it would be desirable.

It's possible that this logic was introduced to somehow deal with a
corrupt "gitdir" file, so that it returns _some_ sort of meaningful
value, but returning the current working directory is not helpful. In
fact, it is quite misleading (except in the one specific case when the
current directory is the worktree whose "gitdir" entry is corrupt).
Moreover, reporting the corrupt value to the user, rather than fibbing
about it and hiding it outright, is more helpful since it may aid in
diagnosing the problem.

Therefore, drop this bogus path munging and restore the logic to the
original behavior of merely stripping "/.git".

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoworktree: drop unused code from get_linked_worktree()
Eric Sunshine [Fri, 31 Jul 2020 23:32:12 +0000 (19:32 -0400)] 
worktree: drop unused code from get_linked_worktree()

This code has been unused since fa099d2322 (worktree.c: kill parse_ref()
in favor of refs_resolve_ref_unsafe(), 2017-04-24), so drop it.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoworktree: drop pointless strbuf_release()
Eric Sunshine [Fri, 31 Jul 2020 23:32:11 +0000 (19:32 -0400)] 
worktree: drop pointless strbuf_release()

The content of this strbuf is unconditionally detached several lines
before the strbuf_release() and the strbuf is never touched again after
that point.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot6300: fix issues related to %(contents:size)
Alban Gruin [Fri, 31 Jul 2020 18:26:07 +0000 (20:26 +0200)] 
t6300: fix issues related to %(contents:size)

b6839fda68 (ref-filter: add support for %(contents:size), 2020-07-16)
added a new format for ref-filter, and added a function to generate
tests for this new feature in t6300.  Unfortunately, it tries to run
`test_expect_sucess' instead of `test_expect_success', and writes
$expect to `expected', but tries to read `expect'.  Those two issues
were probably unnoticed because the script only printed errors, but did
not crash.  This fixes these issues.

Signed-off-by: Alban Gruin <alban.gruin@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agorefs: move the logic to add \t to reflog to the files backend
Han-Wen Nienhuys [Fri, 31 Jul 2020 11:36:10 +0000 (11:36 +0000)] 
refs: move the logic to add \t to reflog to the files backend

523fa69c (reflog: cleanse messages in the refs.c layer, 2020-07-10)
centralized reflog normalizaton.  However, the normalizaton added a
leading "\t" to the message. This is an artifact of the reflog
storage format in the files backend, so it should be added there.

Routines that parse back the reflog (such as grab_nth_branch_switch)
expect the "\t" to not be in the message, so without this fix, git
with reftable cannot process the "@{-1}" syntax.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoThe second batch -- mostly minor typofixes
Junio C Hamano [Fri, 31 Jul 2020 04:34:20 +0000 (21:34 -0700)] 
The second batch -- mostly minor typofixes

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'jb/doc-packfile-name' into master
Junio C Hamano [Fri, 31 Jul 2020 04:34:32 +0000 (21:34 -0700)] 
Merge branch 'jb/doc-packfile-name' into master

Doc update.

* jb/doc-packfile-name:
  pack-write/docs: update regarding pack naming

3 years agoMerge branch 'sg/ci-git-path-fix-with-pyenv' into master
Junio C Hamano [Fri, 31 Jul 2020 04:34:30 +0000 (21:34 -0700)] 
Merge branch 'sg/ci-git-path-fix-with-pyenv' into master

CI fixup---tests of Python scripts didn't use the version of Git
that is being tested.

* sg/ci-git-path-fix-with-pyenv:
  ci: use absolute PYTHON_PATH in the Linux jobs

3 years agoMerge branch 'en/typofixes' into master
Junio C Hamano [Fri, 31 Jul 2020 04:34:30 +0000 (21:34 -0700)] 
Merge branch 'en/typofixes' into master

* en/typofixes:
  hashmap: fix typo in usage docs
  Remove doubled words in various comments

3 years agoMerge branch 'rs/grep-simpler-parse-object-or-die-call' into master
Junio C Hamano [Fri, 31 Jul 2020 04:34:30 +0000 (21:34 -0700)] 
Merge branch 'rs/grep-simpler-parse-object-or-die-call' into master

* rs/grep-simpler-parse-object-or-die-call:
  grep: avoid using oid_to_hex() with parse_object_or_die()

3 years agoMerge branch 'ar/help-guides-doc' into master
Junio C Hamano [Fri, 31 Jul 2020 04:34:29 +0000 (21:34 -0700)] 
Merge branch 'ar/help-guides-doc' into master

* ar/help-guides-doc:
  git-help.txt: fix mentions of option --guides

3 years agoMerge branch 'sk/typofixes' into master
Junio C Hamano [Fri, 31 Jul 2020 04:34:29 +0000 (21:34 -0700)] 
Merge branch 'sk/typofixes' into master

* sk/typofixes:
  comment: fix spelling mistakes inside comments

3 years agostrvec: rename struct fields
Jeff King [Wed, 29 Jul 2020 00:37:20 +0000 (20:37 -0400)] 
strvec: rename struct fields

The "argc" and "argv" names made sense when the struct was argv_array,
but now they're just confusing. Let's rename them to "nr" (which we use
for counts elsewhere) and "v" (which is rather terse, but reads well
when combined with typical variable names like "args.v").

Note that we have to update all of the callers immediately. Playing
tricks with the preprocessor is hard here, because we wouldn't want to
rewrite unrelated tokens.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoFirst batch post 2.28
Junio C Hamano [Thu, 30 Jul 2020 20:20:14 +0000 (13:20 -0700)] 
First batch post 2.28

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'en/fill-directory-exponential' into master
Junio C Hamano [Thu, 30 Jul 2020 20:20:36 +0000 (13:20 -0700)] 
Merge branch 'en/fill-directory-exponential' into master

Fix to a regression introduced during 2.27 cycle.

* en/fill-directory-exponential:
  dir: check pathspecs before returning `path_excluded`

3 years agoMerge branch 'ct/mv-unmerged-path-error' into master
Junio C Hamano [Thu, 30 Jul 2020 20:20:35 +0000 (13:20 -0700)] 
Merge branch 'ct/mv-unmerged-path-error' into master

"git mv src dst", when src is an unmerged path, errored out
correctly but with an incorrect error message to claim that src is
not tracked, which has been clarified.

* ct/mv-unmerged-path-error:
  git-mv: improve error message for conflicted file

3 years agoMerge branch 'bc/push-cas-cquoted-refname' into master
Junio C Hamano [Thu, 30 Jul 2020 20:20:34 +0000 (13:20 -0700)] 
Merge branch 'bc/push-cas-cquoted-refname' into master

Pushing a ref whose name contains non-ASCII character with the
"--force-with-lease" option did not work over smart HTTP protocol,
which has been corrected.

* bc/push-cas-cquoted-refname:
  remote-curl: make --force-with-lease work with non-ASCII ref names

3 years agoMerge branch 'cc/pretty-contents-size' into master
Junio C Hamano [Thu, 30 Jul 2020 20:20:33 +0000 (13:20 -0700)] 
Merge branch 'cc/pretty-contents-size' into master

"git for-each-ref --format=<>" learned %(contents:size).

* cc/pretty-contents-size:
  ref-filter: add support for %(contents:size)
  t6300: test refs pointing to tree and blob
  Documentation: clarify %(contents:XXXX) doc

3 years agoMerge branch 'rs/add-index-entry-optim-fix' into master
Junio C Hamano [Thu, 30 Jul 2020 20:20:33 +0000 (13:20 -0700)] 
Merge branch 'rs/add-index-entry-optim-fix' into master

Fix to an ancient bug caused by an over-eager attempt for
optimization.

* rs/add-index-entry-optim-fix:
  read-cache: remove bogus shortcut

3 years agoMerge branch 'jt/avoid-lazy-fetching-upon-have-check' into master
Junio C Hamano [Thu, 30 Jul 2020 20:20:32 +0000 (13:20 -0700)] 
Merge branch 'jt/avoid-lazy-fetching-upon-have-check' into master

Fetching from a lazily cloned repository resulted at the server
side in attempts to lazy fetch objects that the client side has,
many of which will not be available from the third-party anyway.

* jt/avoid-lazy-fetching-upon-have-check:
  upload-pack: do not lazy-fetch "have" objects

3 years agoMerge branch 'dl/test-must-fail-fixes-6' into master
Junio C Hamano [Thu, 30 Jul 2020 20:20:32 +0000 (13:20 -0700)] 
Merge branch 'dl/test-must-fail-fixes-6' into master

Dev support to limit the use of test_must_fail to only git commands.

* dl/test-must-fail-fixes-6:
  test-lib-functions: restrict test_must_fail usage
  t9400: don't use test_must_fail with cvs
  t9834: remove use of `test_might_fail p4`
  t7107: don't use test_must_fail()
  t5324: reorder `run_with_limited_open_files test_might_fail`
  t3701: stop using `env` in force_color()

3 years agoMerge branch 'jk/reject-newer-extensions-in-v0' into master
Junio C Hamano [Thu, 30 Jul 2020 20:20:32 +0000 (13:20 -0700)] 
Merge branch 'jk/reject-newer-extensions-in-v0' into master

With the base fix to 2.27 regresion, any new extensions in a v0
repository would still be silently honored, which is not quite
right.  Instead, complain and die loudly.

* jk/reject-newer-extensions-in-v0:
  verify_repository_format(): complain about new extensions in v0 repo

3 years agoMerge branch 'hn/reftable' into master
Junio C Hamano [Thu, 30 Jul 2020 20:20:32 +0000 (13:20 -0700)] 
Merge branch 'hn/reftable' into master

Preliminary clean-up of the refs API in preparation for adding a
new refs backend "reftable".

* hn/reftable:
  reflog: cleanse messages in the refs.c layer
  bisect: treat BISECT_HEAD as a pseudo ref
  t3432: use git-reflog to inspect the reflog for HEAD
  lib-t6000.sh: write tag using git-update-ref

3 years agoMerge branch 'bw/fail-cloning-into-non-empty' into master
Junio C Hamano [Thu, 30 Jul 2020 20:20:32 +0000 (13:20 -0700)] 
Merge branch 'bw/fail-cloning-into-non-empty' into master

"git clone --separate-git-dir=$elsewhere" used to stomp on the
contents of the existing directory $elsewhere, which has been
taught to fail when $elsewhere is not an empty directory.

* bw/fail-cloning-into-non-empty:
  git clone: don't clone into non-empty directory

3 years agoMerge branch 'pb/log-rev-list-doc' into master
Junio C Hamano [Thu, 30 Jul 2020 20:20:31 +0000 (13:20 -0700)] 
Merge branch 'pb/log-rev-list-doc' into master

"git help log" has been enhanced by sharing more material from the
documentation for the underlying "git rev-list" command.

* pb/log-rev-list-doc:
  git-log.txt: include rev-list-description.txt
  git-rev-list.txt: move description to separate file
  git-rev-list.txt: tweak wording in set operations
  git-rev-list.txt: fix Asciidoc syntax
  revisions.txt: describe 'rev1 rev2 ...' meaning for ranges
  git-log.txt: add links to 'rev-list' and 'diff' docs

3 years agoMerge branch 'jk/tests-timestamp-fix' into master
Junio C Hamano [Thu, 30 Jul 2020 20:20:31 +0000 (13:20 -0700)] 
Merge branch 'jk/tests-timestamp-fix' into master

The test framework has been updated so that most tests will run
with predictable (artificial) timestamps.

* jk/tests-timestamp-fix:
  t9100: stop depending on commit timestamps
  test-lib: set deterministic default author/committer date
  t9100: explicitly unset GIT_COMMITTER_DATE
  t5539: make timestamp requirements more explicit
  t9700: loosen ident timezone regex
  t6000: use test_tick consistently

3 years agoMerge branch 'ds/commit-graph-bloom-updates' into master
Junio C Hamano [Thu, 30 Jul 2020 20:20:31 +0000 (13:20 -0700)] 
Merge branch 'ds/commit-graph-bloom-updates' into master

Updates to the changed-paths bloom filter.

* ds/commit-graph-bloom-updates:
  commit-graph: check all leading directories in changed path Bloom filters
  revision: empty pathspecs should not use Bloom filters
  revision.c: fix whitespace
  commit-graph: check chunk sizes after writing
  commit-graph: simplify chunk writes into loop
  commit-graph: unify the signatures of all write_graph_chunk_*() functions
  commit-graph: persist existence of changed-paths
  bloom: fix logic in get_bloom_filter()
  commit-graph: change test to die on parse, not load
  commit-graph: place bloom_settings in context

3 years agoMerge branch 'sg/commit-graph-cleanups' into master
Junio C Hamano [Thu, 30 Jul 2020 20:20:30 +0000 (13:20 -0700)] 
Merge branch 'sg/commit-graph-cleanups' into master

The changed-path Bloom filter is improved using ideas from an
independent implementation.

* sg/commit-graph-cleanups:
  commit-graph: simplify write_commit_graph_file() #2
  commit-graph: simplify write_commit_graph_file() #1
  commit-graph: simplify parse_commit_graph() #2
  commit-graph: simplify parse_commit_graph() #1
  commit-graph: clean up #includes
  diff.h: drop diff_tree_oid() & friends' return value
  commit-slab: add a function to deep free entries on the slab
  commit-graph-format.txt: all multi-byte numbers are in network byte order
  commit-graph: fix parsing the Chunk Lookup table
  tree-walk.c: don't match submodule entries for 'submod/anything'

3 years agofmt-merge-msg: allow merge destination to be omitted again
Junio C Hamano [Wed, 29 Jul 2020 22:50:01 +0000 (15:50 -0700)] 
fmt-merge-msg: allow merge destination to be omitted again

In Git 2.28, we stopped special casing 'master' when producing the
default merge message by just removing the code to squelch "into
'master'" at the end of the message.

Introduce multi-valued merge.suppressDest configuration variable
that gives a set of globs to match against the name of the branch
into which the merge is being made, to let users specify for which
branch fmt-merge-msg's output should be shortened.  When it is not
set, 'master' is used as the sole value of the variable by default.

The above move mostly reverts the pre-2.28 default in repositories
that have no relevant configuration.

Add a few tests to protect the behaviour with the new configuration
variable from future regression.

Helped-by: Linus Torvalds <torvalds@linux-foundation.org>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoRevert "fmt-merge-msg: stop treating `master` specially"
Junio C Hamano [Thu, 30 Jul 2020 17:06:42 +0000 (10:06 -0700)] 
Revert "fmt-merge-msg: stop treating `master` specially"

This reverts commit 489947cee5095b168cbac111ff7bd1eadbbd90dd, which
stopped treating merges into the 'master' branch as special when
preparing the default merge message.  As the goal was not to have
any single branch designated as special, it solved it by leaving the
"into <branchname>" at the end of the title of the default merge
message for any and all branches.  An obvious and easy alternative
to treat everybody equally could have been to remove it for every
branch, but that involves loss of information.

We'll introduce a new mechanism to let end-users specify merges into
which branches would omit the "into <branchname>" from the title of
the default merge message, and make the mechanism, when unconfigured,
treat the traditional 'master' special again, so all the changes to
the tests we made earlier will become unnecessary, as these tests
will be run without configuring the said new mechanism.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocomment: fix spelling mistakes inside comments
Steve Kemp [Wed, 29 Jul 2020 03:33:28 +0000 (03:33 +0000)] 
comment: fix spelling mistakes inside comments

This commit fixes a couple of minor spelling mistakes inside
comments.

Signed-off-by: Steve Kemp <steve@steve.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogit-help.txt: fix mentions of option --guides
Andrei Rybak [Wed, 29 Jul 2020 13:39:48 +0000 (15:39 +0200)] 
git-help.txt: fix mentions of option --guides

Fix typos introduced in commit a133737b80 ("doc: include --guide option
description for "git help"", 2013-04-02).

Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogrep: avoid using oid_to_hex() with parse_object_or_die()
René Scharfe [Tue, 28 Jul 2020 21:40:38 +0000 (23:40 +0200)] 
grep: avoid using oid_to_hex() with parse_object_or_die()

parse_object_or_die() is passed an object ID and a name to show if the
object cannot be parsed.  If the name is NULL then it shows the
hexadecimal object ID.  Use that feature instead of preparing and
passing the hexadecimal representation to the function proactively.
That's shorter and a bit more efficient.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agostrvec: drop argv_array compatibility layer
Jeff King [Tue, 28 Jul 2020 20:27:09 +0000 (16:27 -0400)] 
strvec: drop argv_array compatibility layer

There are no callers which need it anymore. Any topics in flight will
need to be updated as they get merged in (but the compiler will make
that quite clear).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agostrvec: update documention to avoid argv_array
Jeff King [Tue, 28 Jul 2020 20:26:57 +0000 (16:26 -0400)] 
strvec: update documention to avoid argv_array

There were a few mentions of argv_array in a non-code file which didn't
get picked up in the previous commits (note that even comments in code
files were already covered because of the mechanical conversion via
perl).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agostrvec: fix indentation in renamed calls
Jeff King [Tue, 28 Jul 2020 20:26:31 +0000 (16:26 -0400)] 
strvec: fix indentation in renamed calls

Code which split an argv_array call across multiple lines, like:

  argv_array_pushl(&args, "one argument",
                   "another argument", "and more",
   NULL);

was recently mechanically renamed to use strvec, which results in
mis-matched indentation like:

  strvec_pushl(&args, "one argument",
                   "another argument", "and more",
   NULL);

Let's fix these up to align the arguments with the opening paren. I did
this manually by sifting through the results of:

  git jump grep 'strvec_.*,$'

and liberally applying my editor's auto-format. Most of the changes are
of the form shown above, though I also normalized a few that had
originally used a single-tab indentation (rather than our usual style of
aligning with the open paren). I also rewrapped a couple of obvious
cases (e.g., where previously too-long lines became short enough to fit
on one), but I wasn't aggressive about it. In cases broken to three or
more lines, the grouping of arguments is sometimes meaningful, and it
wasn't worth my time or reviewer time to ponder each case individually.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agostrvec: convert remaining callers away from argv_array name
Jeff King [Tue, 28 Jul 2020 20:25:12 +0000 (16:25 -0400)] 
strvec: convert remaining callers away from argv_array name

We eventually want to drop the argv_array name and just use strvec
consistently. There's no particular reason we have to do it all at once,
or care about interactions between converted and unconverted bits.
Because of our preprocessor compat layer, the names are interchangeable
to the compiler (so even a definition and declaration using different
names is OK).

This patch converts all of the remaining files, as the resulting diff is
reasonably sized.

The conversion was done purely mechanically with:

  git ls-files '*.c' '*.h' |
  xargs perl -i -pe '
    s/ARGV_ARRAY/STRVEC/g;
    s/argv_array/strvec/g;
  '

We'll deal with any indentation/style fallouts separately.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agostrvec: convert more callers away from argv_array name
Jeff King [Tue, 28 Jul 2020 20:24:53 +0000 (16:24 -0400)] 
strvec: convert more callers away from argv_array name

We eventually want to drop the argv_array name and just use strvec
consistently. There's no particular reason we have to do it all at once,
or care about interactions between converted and unconverted bits.
Because of our preprocessor compat layer, the names are interchangeable
to the compiler (so even a definition and declaration using different
names is OK).

This patch converts remaining files from the first half of the alphabet,
to keep the diff to a manageable size.

The conversion was done purely mechanically with:

  git ls-files '*.c' '*.h' |
  xargs perl -i -pe '
    s/ARGV_ARRAY/STRVEC/g;
    s/argv_array/strvec/g;
  '

and then selectively staging files with "git add '[abcdefghjkl]*'".
We'll deal with any indentation/style fallouts separately.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agostrvec: convert builtin/ callers away from argv_array name
Jeff King [Tue, 28 Jul 2020 20:24:27 +0000 (16:24 -0400)] 
strvec: convert builtin/ callers away from argv_array name

We eventually want to drop the argv_array name and just use strvec
consistently. There's no particular reason we have to do it all at once,
or care about interactions between converted and unconverted bits.
Because of our preprocessor compat layer, the names are interchangeable
to the compiler (so even a definition and declaration using different
names is OK).

This patch converts all of the files in builtin/ to keep the diff to a
manageable size.

The conversion was done purely mechanically with:

  git ls-files '*.c' '*.h' |
  xargs perl -i -pe '
    s/ARGV_ARRAY/STRVEC/g;
    s/argv_array/strvec/g;
  '

and then selectively staging files with "git add builtin/". We'll deal
with any indentation/style fallouts separately.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoquote: rename sq_dequote_to_argv_array to mention strvec
Jeff King [Tue, 28 Jul 2020 20:24:02 +0000 (16:24 -0400)] 
quote: rename sq_dequote_to_argv_array to mention strvec

We want to eventually drop the use of the "argv_array" name in favor of
"strvec." Unlike most other uses of the name, this one is embedded in a
function name, so the definition and all of the callers need to be
updated at the same time.

We don't technically need to update the parameter types here (our
preprocessor compat macros make the two names interchangeable), but
let's do so to keep the site consistent for now.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agostrvec: rename files from argv-array to strvec
Jeff King [Tue, 28 Jul 2020 20:23:39 +0000 (16:23 -0400)] 
strvec: rename files from argv-array to strvec

This requires updating #include lines across the code-base, but that's
all fairly mechanical, and was done with:

  git ls-files '*.c' '*.h' |
  xargs perl -i -pe 's/argv-array.h/strvec.h/'

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoargv-array: rename to strvec
Jeff King [Tue, 28 Jul 2020 20:23:25 +0000 (16:23 -0400)] 
argv-array: rename to strvec

The name "argv-array" isn't very good, because it describes what the
data type can be used for (program argument arrays), not what it
actually is (a dynamically-growing string array that maintains a
NULL-terminator invariant). This leads to people being hesitant to use
it for other cases where it would actually be a good fit. The existing
name is also clunky to use. It's overly long, and the name often leads
to saying things like "argv.argv" (i.e., the field names overlap with
variable names, since they're describing the use, not the type). Let's
give it a more neutral name.

I settled on "strvec" because "vector" is the name for a dynamic array
type in many programming languages. "strarray" would work, too, but it's
longer and a bit more awkward to say (and don't we all say these things
in our mind as we type them?).

A more extreme direction would be a generic data structure which stores
a NULL-terminated of _any_ type. That would be easy to do with void
pointers, but we'd lose some type safety for the existing cases. Plus it
raises questions about memory allocation and ownership. So I limited
myself here to changing names only, and not semantics. If we do find a
use for that more generic data type, we could perhaps implement it at a
lower level and then provide type-safe wrappers around it for strings.
But that can come later.

This patch does the minimum to convert the struct and function names in
the header and implementation, leaving a few things for follow-on
patches:

  - files retain their original names for now

  - struct field names are retained for now

  - there's a preprocessor compat layer that lets most users remain the
    same for now. The exception is headers which made a manual forward
    declaration of the struct. I've converted them (and their dependent
    function declarations) here.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoargv-array: use size_t for count and alloc
Jeff King [Tue, 28 Jul 2020 20:21:52 +0000 (16:21 -0400)] 
argv-array: use size_t for count and alloc

On most 64-bit platforms, "int" is significantly smaller than a size_t,
which could lead to integer overflow and under-allocation of the array.
It's probably impossible to trigger in practice, as it would imply on
the order of 2^32 individual allocations. Even if was possible to grow
an array in that way (and we typically only use it for sets of strings,
like command line options), each allocation needs a pointer, malloc
overhead, etc. You'd quite likely run out of RAM before succeeding in
such an overflow.

But all that hand-waving aside, it's easy enough to use the correct
type, so let's do so.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agohashmap: fix typo in usage docs
Elijah Newren [Tue, 28 Jul 2020 20:45:39 +0000 (20:45 +0000)] 
hashmap: fix typo in usage docs

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoRemove doubled words in various comments
Elijah Newren [Tue, 28 Jul 2020 20:45:38 +0000 (20:45 +0000)] 
Remove doubled words in various comments

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoGit 2.28 v2.28.0
Junio C Hamano [Mon, 27 Jul 2020 01:01:43 +0000 (18:01 -0700)] 
Git 2.28

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge tag 'l10n-2.28.0-rnd1' of https://www.github.com/git-l10n/git-po into master
Junio C Hamano [Sun, 26 Jul 2020 16:48:11 +0000 (09:48 -0700)] 
Merge tag 'l10n-2.28.0-rnd1' of https://www.github.com/git-l10n/git-po into master

l10n-2.28.0-rnd1

* tag 'l10n-2.28.0-rnd1' of https://www.github.com/git-l10n/git-po:
  l10n: es: 2.28.0 round 1
  l10n: de.po: Update German translation for Git v2.28.0
  l10n: de.po: fix grammar
  l10n: zh_CN: for git v2.28.0 l10n round 1
  l10n: zh_TW.po: v2.28.0 round 1 (0 untranslated)
  l10n: vi.po: correct "ident line" translation
  l10n: vi.po(4931t): Updated translation for v2.28.0
  l10n: fr v2.28.0 round 1
  l10n: sv.po: Update Swedish translation (4931t0f0u)
  l10n: it.po: update the Italian translation for Git 2.28.0 round 1
  l10n: tr: v2.28.0 round 1
  l10n: git.pot: v2.28.0 round 1 (70 new, 14 removed)
  l10n: Update Catalan translation

3 years agoMerge branch 'master' of github.com:Softcatala/git-po
Jiang Xin [Sun, 26 Jul 2020 16:05:41 +0000 (00:05 +0800)] 
Merge branch 'master' of github.com:Softcatala/git-po

* 'master' of github.com:Softcatala/git-po:
  l10n: Update Catalan translation

3 years agol10n: es: 2.28.0 round 1
Christopher Diaz Riveros [Sun, 26 Jul 2020 15:12:01 +0000 (10:12 -0500)] 
l10n: es: 2.28.0 round 1

Signed-off-by: Christopher Diaz Riveros <christopher.diaz.riv@gmail.com>
3 years agoMerge branch 'ps/ref-transaction-hook' into master
Junio C Hamano [Fri, 24 Jul 2020 22:54:05 +0000 (15:54 -0700)] 
Merge branch 'ps/ref-transaction-hook' into master

A new hook.

* ps/ref-transaction-hook:
  githooks.txt: use correct "reference-transaction" hook name

3 years agogithooks.txt: use correct "reference-transaction" hook name
Bojun Chen [Fri, 24 Jul 2020 13:57:57 +0000 (13:57 +0000)] 
githooks.txt: use correct "reference-transaction" hook name

The "reference transaction" hook was introduced in commit 6754159767
(refs: implement reference transaction hook, 2020-06-19). The name of
the hook is declared as "reference-transaction" in "refs.c" and
testcases, but the name declared in "githooks.txt" is different.

Signed-off-by: Bojun Chen <bojun.cbj@alibaba-inc.com>
Reviewed-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agol10n: de.po: Update German translation for Git v2.28.0
Matthias Rüster [Sun, 12 Jul 2020 11:18:30 +0000 (13:18 +0200)] 
l10n: de.po: Update German translation for Git v2.28.0

Reviewed-by: Ralf Thielow <ralf.thielow@gmail.com>
Signed-off-by: Matthias Rüster <matthias.ruester@gmail.com>