git
4 years agoMerge branch 'ao/p4-avoid-decoding' into seen
Junio C Hamano [Sat, 19 Jun 2021 07:30:19 +0000 (16:30 +0900)] 
Merge branch 'ao/p4-avoid-decoding' into seen

"git p4" in Python-2 days used to accept a lot more kinds of data
from Perforce server as uninterrupted byte sequence, but after
switching to Python-3, too many things are expected to be in UTF-8,
which broke traditional use cases.

* ao/p4-avoid-decoding:
  git-p4: do not decode data from perforce by default
  git-p4: avoid decoding more data from perforce

4 years agoMerge branch 'jh/builtin-fsmonitor' into seen
Junio C Hamano [Sat, 19 Jun 2021 07:30:18 +0000 (16:30 +0900)] 
Merge branch 'jh/builtin-fsmonitor' into seen

An attempt to write and ship with a watchman equivalent tailored
for our use.

What's the status of this one?

* jh/builtin-fsmonitor: (28 commits)
  t/perf: avoid copying builtin fsmonitor files into test repo
  t7527: test status with untracked-cache and fsmonitor--daemon
  p7519: add fsmonitor--daemon
  t7527: create test for fsmonitor--daemon
  fsmonitor: force update index after large responses
  fsmonitor: enhance existing comments
  fsmonitor--daemon: use a cookie file to sync with file system
  fsmonitor--daemon: periodically truncate list of modified files
  fsmonitor--daemon: implement handle_client callback
  fsmonitor-fs-listen-macos: implement FSEvent listener on MacOS
  fsmonitor-fs-listen-macos: add macos header files for FSEvent
  fsmonitor-fs-listen-win32: implement FSMonitor backend on Windows
  fsmonitor--daemon: create token-based changed path cache
  fsmonitor--daemon: define token-ids
  fsmonitor--daemon: add pathname classification
  fsmonitor--daemon: implement daemon command options
  fsmonitor-fs-listen-macos: stub in backend for MacOS
  fsmonitor-fs-listen-win32: stub in backend for Windows
  t/helper/fsmonitor-client: create IPC client to talk to FSMonitor Daemon
  fsmonitor--daemon: implement client command options
  ...

4 years agoMerge branch 'gh/gitweb-branch-sort' into seen
Junio C Hamano [Sat, 19 Jun 2021 07:30:18 +0000 (16:30 +0900)] 
Merge branch 'gh/gitweb-branch-sort' into seen

Tie-break branches that point at the same object in the list of
branches on GitWeb to show the one pointed at by HEAD early.

* gh/gitweb-branch-sort:
  gitweb: use HEAD as secondary sort key in git_get_heads_list()

4 years agoMerge branch 'ab/cmd-foo-should-return' into seen
Junio C Hamano [Sat, 19 Jun 2021 07:30:17 +0000 (16:30 +0900)] 
Merge branch 'ab/cmd-foo-should-return' into seen

Code clean-up.

* ab/cmd-foo-should-return:
  builtins + test helpers: use return instead of exit() in cmd_*

4 years agoMerge branch 'lh/systemd-timers' into seen
Junio C Hamano [Sat, 19 Jun 2021 07:30:17 +0000 (16:30 +0900)] 
Merge branch 'lh/systemd-timers' into seen

"git maintenance" scheduler learned to use systemd timers as a
possible backend.

* lh/systemd-timers:
  maintenance: add support for systemd timers on Linux
  maintenance: `git maintenance run` learned `--scheduler=<scheduler>`
  cache.h: Introduce a generic "xdg_config_home_for(…)" function

4 years agoMerge branch 'ar/doc-libera-chat-in-my-first-contrib' into seen
Junio C Hamano [Sat, 19 Jun 2021 07:30:17 +0000 (16:30 +0900)] 
Merge branch 'ar/doc-libera-chat-in-my-first-contrib' into seen

Update MyFirst document.

* ar/doc-libera-chat-in-my-first-contrib:
  MyFirstContribution: link #git-devel to Libera Chat

4 years agoMerge branch 'ar/mailinfo-memcmp-to-skip-prefix' into seen
Junio C Hamano [Sat, 19 Jun 2021 07:30:17 +0000 (16:30 +0900)] 
Merge branch 'ar/mailinfo-memcmp-to-skip-prefix' into seen

Code clean-up.

* ar/mailinfo-memcmp-to-skip-prefix:
  mailinfo: use starts_with() when checking scissors

4 years agoMerge branch 'en/ort-perf-batch-12' into seen
Junio C Hamano [Sat, 19 Jun 2021 07:30:16 +0000 (16:30 +0900)] 
Merge branch 'en/ort-perf-batch-12' into seen

More fix-ups and optimization to "merge -sort".

* en/ort-perf-batch-12:
  merge-ort: miscellaneous touch-ups
  Fix various issues found in comments
  diffcore-rename: avoid unnecessary strdup'ing in break_idx
  merge-ort: replace string_list_df_name_compare with faster alternative

4 years agoMerge branch 'es/trace2-log-parent-process-name' into seen
Junio C Hamano [Sat, 19 Jun 2021 07:30:16 +0000 (16:30 +0900)] 
Merge branch 'es/trace2-log-parent-process-name' into seen

trace2 logs learned to show parent process name to see in what
context Git was invoked.

* es/trace2-log-parent-process-name:
  tr2: log parent process name

4 years agoMerge branch 'jk/doc-max-pack-size' into seen
Junio C Hamano [Sat, 19 Jun 2021 07:30:16 +0000 (16:30 +0900)] 
Merge branch 'jk/doc-max-pack-size' into seen

Doc update.

* jk/doc-max-pack-size:
  doc: warn people against --max-pack-size

4 years agoMerge branch 'hn/refs-errno-cleanup' into seen
Junio C Hamano [Sat, 19 Jun 2021 07:30:15 +0000 (16:30 +0900)] 
Merge branch 'hn/refs-errno-cleanup' into seen

Futz with the way 'errno' is relied on in the refs API to carry the
failure modes up the callchain.

* hn/refs-errno-cleanup:
  refs: explicitly propagate errno from refs_read_raw_ref
  refs: clear errno return in refs_resolve_ref_unsafe()
  refs: add failure_errno to refs_read_raw_ref() signature
  refs: use refs_resolve_ref_unsafe_with_errno() where needed
  refs: make errno output explicit for refs_resolve_ref_unsafe
  refs: make errno output explicit for read_raw_ref_fn
  refs/files-backend: stop setting errno from lock_ref_oid_basic
  refs: remove EINVAL errno output from specification of read_raw_ref_fn

4 years agoMerge branch 'jt/partial-clone-submodule-1' into seen
Junio C Hamano [Sat, 19 Jun 2021 07:30:15 +0000 (16:30 +0900)] 
Merge branch 'jt/partial-clone-submodule-1' into seen

Prepare the internals for lazily fetching objects in submodules
from their promisor remotes.

* jt/partial-clone-submodule-1:
  promisor-remote: teach lazy-fetch in any repo
  run-command: refactor subprocess env preparation
  submodule: refrain from filtering GIT_CONFIG_COUNT
  promisor-remote: support per-repository config
  repository: move global r_f_p_c to repo struct

4 years agoMerge branch 'ar/submodule-add' into seen
Junio C Hamano [Sat, 19 Jun 2021 07:30:15 +0000 (16:30 +0900)] 
Merge branch 'ar/submodule-add' into seen

Rewrite of "git submodule" in C continues.

* ar/submodule-add:
  submodule--helper: introduce add-config subcommand
  submodule--helper: introduce add-clone subcommand
  submodule--helper: refactor module_clone()

4 years agoMerge branch 'fw/complete-cmd-idx-fix' into jch
Junio C Hamano [Sat, 19 Jun 2021 07:30:05 +0000 (16:30 +0900)] 
Merge branch 'fw/complete-cmd-idx-fix' into jch

* fw/complete-cmd-idx-fix:
  completion: bash: fix late declaration of __git_cmd_idx

4 years agoMerge branch 'jk/test-without-readlink-1' into jch
Junio C Hamano [Sat, 19 Jun 2021 07:30:00 +0000 (16:30 +0900)] 
Merge branch 'jk/test-without-readlink-1' into jch

* jk/test-without-readlink-1:
  t: use portable wrapper for readlink(1)

4 years agocompletion: bash: fix late declaration of __git_cmd_idx
Fabian Wermelinger [Fri, 18 Jun 2021 14:02:57 +0000 (16:02 +0200)] 
completion: bash: fix late declaration of __git_cmd_idx

A recent update to contrib/completion/git-completion.bash causes bash to fail
auto complete custom commands that are wrapped with __git_func_wrap. Declaring
__git_cmd_idx=0 inside __git_func_wrap resolves the issue.

Signed-off-by: Fabian Wermelinger <fabianw@mavt.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot: use portable wrapper for readlink(1)
Jeff King [Fri, 18 Jun 2021 16:32:22 +0000 (12:32 -0400)] 
t: use portable wrapper for readlink(1)

Not all systems have a readlink program available for use by the shell.
This causes t3210 to fail on at least AIX. Let's provide a perl
one-liner to do the same thing, and use it there.

I also updated calls in t9802. Nobody reported failure there, but it's
the same issue. Presumably nobody actually tests with p4 on AIX in the
first place (if it is even available there).

I left the use of readlink in the "--valgrind" setup in test-lib.sh, as
valgrind isn't available on exotic platforms anyway (and I didn't want
to increase dependencies between test-lib.sh and test-lib-functions.sh).

There's one other curious case. Commit d2addc3b96 (t7800: readlink may
not be available, 2016-05-31) fixed a similar case. We can't use our
wrapper function there, though, as it's inside a sub-script triggered by
Git. It uses a slightly different technique ("ls" piped to "sed"). I
chose not to use that here as it gives confusing "ls -l" output if the
file is unexpectedly not a symlink (which is OK for its limited use, but
potentially confusing for general use within the test suite). The perl
version emits the empty string.

Reported-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoMerge branch 'jx/sideband-cleanup' into jch
Junio C Hamano [Thu, 17 Jun 2021 05:57:41 +0000 (14:57 +0900)] 
Merge branch 'jx/sideband-cleanup' into jch

* jx/sideband-cleanup:
  test: refactor to use "get_abbrev_oid" to get abbrev oid
  test: refactor to use "test_commit" to create commits
  test: compare raw output, not mangle tabs and spaces
  sideband: don't lose clear-to-eol at packet boundary

4 years agoMerge branch 'jk/test-avoid-globmatch-with-skip-patterns' into jch
Junio C Hamano [Thu, 17 Jun 2021 05:52:09 +0000 (14:52 +0900)] 
Merge branch 'jk/test-avoid-globmatch-with-skip-patterns' into jch

* jk/test-avoid-globmatch-with-skip-patterns:
  test-lib: avoid accidental globbing in match_pattern_list()

4 years agoMerge branch 'jv/userdiff-csharp-update' into jch
Junio C Hamano [Thu, 17 Jun 2021 05:51:53 +0000 (14:51 +0900)] 
Merge branch 'jv/userdiff-csharp-update' into jch

The userdiff pattern for C# learned the token "record".

* jv/userdiff-csharp-update:
  userdiff: add support for C# record types

4 years agoMerge branch 'ab/pre-auto-gc-hook-test' into jch
Junio C Hamano [Thu, 17 Jun 2021 05:51:52 +0000 (14:51 +0900)] 
Merge branch 'ab/pre-auto-gc-hook-test' into jch

Test fix.

* ab/pre-auto-gc-hook-test:
  gc tests: add a test for the "pre-auto-gc" hook

4 years agoMerge branch 'ab/config-hooks-path-testfix' into jch
Junio C Hamano [Thu, 17 Jun 2021 05:51:52 +0000 (14:51 +0900)] 
Merge branch 'ab/config-hooks-path-testfix' into jch

Test fix.

* ab/config-hooks-path-testfix:
  pre-commit hook tests: don't leave "actual" nonexisting on failure

4 years agoMerge branch 'fc/pull-cleanups' into jch
Junio C Hamano [Thu, 17 Jun 2021 05:51:52 +0000 (14:51 +0900)] 
Merge branch 'fc/pull-cleanups' into jch

Code cleanup.

* fc/pull-cleanups:
  pull: trivial whitespace style fix
  pull: trivial cleanup
  pull: cleanup autostash check

4 years agoMerge branch 'jk/bitmap-tree-optim' into jch
Junio C Hamano [Thu, 17 Jun 2021 05:51:52 +0000 (14:51 +0900)] 
Merge branch 'jk/bitmap-tree-optim' into jch

Avoid duplicated work while building reachability bitmaps.

* jk/bitmap-tree-optim:
  bitmaps: don't recurse into trees already in the bitmap

4 years agoMerge branch 'ab/mktag-tests' into jch
Junio C Hamano [Thu, 17 Jun 2021 05:51:51 +0000 (14:51 +0900)] 
Merge branch 'ab/mktag-tests' into jch

Fill test gaps.

* ab/mktag-tests:
  mktag tests: test fast-export
  mktag tests: test for-each-ref
  mktag tests: test update-ref and reachable fsck
  mktag tests: test hash-object --literally and unreachable fsck
  mktag tests: invert --no-strict test
  mktag tests: parse out options in helper

4 years agoMerge branch 'ab/show-branch-tests' into jch
Junio C Hamano [Thu, 17 Jun 2021 05:51:51 +0000 (14:51 +0900)] 
Merge branch 'ab/show-branch-tests' into jch

Fill test gaps.

* ab/show-branch-tests:
  show-branch tests: add missing tests
  show-branch: fix and test --color output
  show-branch tests: modernize test code
  show-branch tests: rename the one "show-branch" test file

4 years agoMerge branch 'ah/graph-typofix' into jch
Junio C Hamano [Thu, 17 Jun 2021 05:51:51 +0000 (14:51 +0900)] 
Merge branch 'ah/graph-typofix' into jch

Typofix in an error message.

* ah/graph-typofix:
  graph: improve grammar of "invalid color" error message

4 years agoMerge branch 'ds/gender-neutral-doc' into jch
Junio C Hamano [Thu, 17 Jun 2021 05:51:50 +0000 (14:51 +0900)] 
Merge branch 'ds/gender-neutral-doc' into jch

Attempt to update the documentation not to assume users are of
certain gender and adds to guidelines to do so.

* ds/gender-neutral-doc:
  SQUASH??? replace neutering tips with that of Æver
  CodingGuidelines: recommend singular they
  *: fix typos
  comments: avoid using the gender of our users
  doc: avoid using the gender of other people

4 years agoMerge branch 'jx/t6020-with-older-bash' into jch
Junio C Hamano [Thu, 17 Jun 2021 05:51:50 +0000 (14:51 +0900)] 
Merge branch 'jx/t6020-with-older-bash' into jch

Work around inefficient glob substitution in older versions of bash
by rewriting parts of a test.

* jx/t6020-with-older-bash:
  t6020: fix incompatible parameter expansion

4 years agotest: refactor to use "get_abbrev_oid" to get abbrev oid
Jiang Xin [Thu, 17 Jun 2021 03:17:27 +0000 (11:17 +0800)] 
test: refactor to use "get_abbrev_oid" to get abbrev oid

Add new function "get_abbrev_oid" to get abbrev object ID.  This
function has a default value which helps to prepare a nonempty replace
pattern for sed command.  An empty replace pattern may cause sed fail
to allocate memory.

Refactor function "make_user_friendly_and_stable_output" to use
"get_abbrev_oid" to get abbrev object ID.

Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agotest: refactor to use "test_commit" to create commits
Jiang Xin [Thu, 17 Jun 2021 03:17:26 +0000 (11:17 +0800)] 
test: refactor to use "test_commit" to create commits

Refactor function "create_commits_in" to use "test_commit" to create
commit.

Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agotest: compare raw output, not mangle tabs and spaces
Jiang Xin [Thu, 17 Jun 2021 03:17:25 +0000 (11:17 +0800)] 
test: compare raw output, not mangle tabs and spaces

Before comparing with the expect file, we used to call function
"make_user_friendly_and_stable_output" to filter out trailing spaces in
output.  Ævar recommends using pattern "s/Z$//" to prepare expect file,
and then compare it with raw output.

Since we have fixed the issue of occasionally missing the clear-to-eol
suffix when displaying sideband #2 messages, it is safe and stable to
test against raw output.

Suggested-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agosideband: don't lose clear-to-eol at packet boundary
Jiang Xin [Thu, 17 Jun 2021 03:17:24 +0000 (11:17 +0800)] 
sideband: don't lose clear-to-eol at packet boundary

When "demultiplex_sideband()" sees a nonempty message ending with CR or
LF on the sideband #2, it adds "suffix" string to clear to the end of
the current line, which helps when relaying a progress display whose
records are terminated with CRs.  But if it sees a single LF, no
clear-to-end suffix should be appended, because this single LF is used
to end the progress display by moving to the next line, and the final
progress display above should be preserved.

However, the code forgot that depending on the length of the payload
line, such a CR may fall exactly at the packet boundary and the
number of bytes before the CR from the beginning of the packet could
be zero.  In such a case, the message that was terminated by the CR
were leftover in the "scratch" buffer in the previous call to the
function and we still need to clear to the end of the current line.

Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot6020: fix incompatible parameter expansion
Jiang Xin [Thu, 17 Jun 2021 03:14:11 +0000 (11:14 +0800)] 
t6020: fix incompatible parameter expansion

Ævar reported that the function `make_user_friendly_and_stable_output()`
failed on a i386 box (gcc45) in the gcc farm boxes with error:

    sed: couldn't re-allocate memory

It turns out that older versions of bash (4.3) or dash (0.5.7) cannot
evaluate expression like `${A%${A#???????}}` used to get the leading 7
characters of variable A.

Replace the incompatible parameter expansion so that t6020 works on
older version of bash or dash.

Reported-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agotest-lib: avoid accidental globbing in match_pattern_list()
Jeff King [Wed, 16 Jun 2021 10:23:07 +0000 (06:23 -0400)] 
test-lib: avoid accidental globbing in match_pattern_list()

We have a custom match_pattern_list() function which we use for matching
test names (like "t1234") against glob-like patterns (like "t1???") for
$GIT_SKIP_TESTS, --verbose-only, etc.

Those patterns may have multiple whitespace-separated elements (e.g.,
"t0* t1234 t5?78"). The callers of match_pattern_list thus pass the
strings unquoted, so that the shell does the usual field-splitting into
separate arguments.

But this also means the shell will do the usual globbing for each
argument, which can result in us seeing an expansion based on what's in
the filesystem, rather than the real pattern. For example, if I have the
path "t5000" in the filesystem, and you feed the pattern "t?0000", that
_should_ match the string "t0000", but it won't after the shell has
expanded it to "t5000".

This has been a bug ever since that function was introduced. But it
didn't usually trigger since we typically use the function inside the
trash directory, which has a very limited set of files that are unlikely
to match. It became a lot easier to trigger after edc23840b0 (test-lib:
bring $remove_trash out of retirement, 2021-05-10), because now we match
$GIT_SKIP_TESTS before even entering the trash directory. So the t5000
example above can be seen with:

  GIT_SKIP_TESTS=t?000 ./t0000-basic.sh

which should skip all tests but doesn't.

We can fix this by using "set -f" to ask the shell not to glob (which is
in POSIX, so should hopefully be portable enough). We only want to do
this in a subshell (to avoid polluting the rest of the script), which
means we need to get the whole string intact into the match_pattern_list
function by quoting it. Arguably this is a good idea anyway, since it
makes it much more obvious that we intend to split, and it's not simply
sloppy scripting.

Diagnosed-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoMerge branch 'ar/typofix' into jch
Junio C Hamano [Thu, 17 Jun 2021 02:26:21 +0000 (11:26 +0900)] 
Merge branch 'ar/typofix' into jch

Typofixes.

* ar/typofix:
  *: fix typos which duplicate a word

4 years agoMerge branch 'jk/union-merge-binary' into jch
Junio C Hamano [Thu, 17 Jun 2021 02:26:20 +0000 (11:26 +0900)] 
Merge branch 'jk/union-merge-binary' into jch

The "union" conflict resultion variant misbehaved when used with
binary merge driver.

* jk/union-merge-binary:
  ll_union_merge(): rename path_unused parameter
  ll_union_merge(): pass name labels to ll_xdl_merge()
  ll_binary_merge(): handle XDL_MERGE_FAVOR_UNION

4 years agoMerge branch 'jk/revision-squelch-gcc-warning' into jch
Junio C Hamano [Thu, 17 Jun 2021 02:26:20 +0000 (11:26 +0900)] 
Merge branch 'jk/revision-squelch-gcc-warning' into jch

Warning fix.

* jk/revision-squelch-gcc-warning:
  add_pending_object_with_path(): work around "gcc -O3" complaint

4 years agoMerge branch 'ah/uninitialized-reads-fix' into jch
Junio C Hamano [Thu, 17 Jun 2021 02:26:20 +0000 (11:26 +0900)] 
Merge branch 'ah/uninitialized-reads-fix' into jch

Make the codebase MSAN clean.

* ah/uninitialized-reads-fix:
  builtin/checkout--worker: zero-initialise struct to avoid MSAN complaints
  split-index: use oideq instead of memcmp to compare object_id's
  bulk-checkin: make buffer reuse more obvious and safer

4 years agoMerge branch 'js/no-more-multimail' into jch
Junio C Hamano [Thu, 17 Jun 2021 02:26:19 +0000 (11:26 +0900)] 
Merge branch 'js/no-more-multimail' into jch

Remove multimail from contrib/

* js/no-more-multimail:
  multimail: stop shipping a copy

4 years agoMerge branch 'js/subtree-on-windows-fix' into jch
Junio C Hamano [Thu, 17 Jun 2021 02:26:19 +0000 (11:26 +0900)] 
Merge branch 'js/subtree-on-windows-fix' into jch

Update "git subtree" to work better on Windows.

* js/subtree-on-windows-fix:
  subtree: fix assumption about the directory separator
  subtree: fix the GIT_EXEC_PATH sanity check to work on Windows

4 years agoMerge branch 'fc/completion-updates' into jch
Junio C Hamano [Thu, 17 Jun 2021 02:26:19 +0000 (11:26 +0900)] 
Merge branch 'fc/completion-updates' into jch

Command line completion updates.

* fc/completion-updates:
  completion: bash: add correct suffix in variables
  completion: bash: fix for multiple dash commands
  completion: bash: fix for suboptions with value
  completion: bash: fix prefix detection in branch.*

4 years agoMerge branch 'dd/svn-test-wo-locale-a' into jch
Junio C Hamano [Thu, 17 Jun 2021 02:26:19 +0000 (11:26 +0900)] 
Merge branch 'dd/svn-test-wo-locale-a' into jch

"git-svn" tests assumed that "locale -a", which is used to pick an
available UTF-8 locale, is available everywhere.  A knob has been
introduced to allow testers to specify a suitable locale to use.

* dd/svn-test-wo-locale-a:
  t: use user-specified utf-8 locale for testing svn

4 years agoMerge branch 'fc/doc-default-to-upstream-config' into jch
Junio C Hamano [Thu, 17 Jun 2021 02:26:18 +0000 (11:26 +0900)] 
Merge branch 'fc/doc-default-to-upstream-config' into jch

Doc clean-up.

* fc/doc-default-to-upstream-config:
  doc: merge: mention default of defaulttoupstream

4 years agoMerge branch 'mr/cmake' into jch
Junio C Hamano [Thu, 17 Jun 2021 02:26:18 +0000 (11:26 +0900)] 
Merge branch 'mr/cmake' into jch

CMake update.

* mr/cmake:
  cmake: add warning for ignored MSGFMT_EXE
  cmake: create compile_commands.json by default
  cmake: add knob to disable vcpkg

4 years agoMerge branch 'zh/cat-file-batch-fix' into jch
Junio C Hamano [Thu, 17 Jun 2021 02:26:17 +0000 (11:26 +0900)] 
Merge branch 'zh/cat-file-batch-fix' into jch

"git cat-file --batch-all-objects"" misbehaved when "--batch" is in
use and did not ask for certain object traits.

* zh/cat-file-batch-fix:
  cat-file: merge two block into one
  cat-file: handle trivial --batch format with --batch-all-objects

4 years agoMerge branch 'ab/describe-tests-fix' into jch
Junio C Hamano [Thu, 17 Jun 2021 02:26:17 +0000 (11:26 +0900)] 
Merge branch 'ab/describe-tests-fix' into jch

Various updates to tests around "git describe"

* ab/describe-tests-fix:
  describe tests: support -C in "check_describe"
  describe tests: fix nested "test_expect_success" call
  describe tests: don't rely on err.actual from "check_describe"
  describe tests: refactor away from glob matching
  describe tests: improve test for --work-tree & --dirty

4 years agoMerge branch 'ab/pickaxe-pcre2' into jch
Junio C Hamano [Thu, 17 Jun 2021 02:26:17 +0000 (11:26 +0900)] 
Merge branch 'ab/pickaxe-pcre2' into jch

Rewrite the backend for "diff -G/-S" to use pcre2 engine when
available.

* ab/pickaxe-pcre2: (22 commits)
  xdiff-interface: replace discard_hunk_line() with a flag
  xdiff users: use designated initializers for out_line
  pickaxe -G: don't special-case create/delete
  pickaxe -G: terminate early on matching lines
  xdiff-interface: allow early return from xdiff_emit_line_fn
  xdiff-interface: prepare for allowing early return
  pickaxe -S: slightly optimize contains()
  pickaxe: rename variables in has_changes() for brevity
  pickaxe -S: support content with NULs under --pickaxe-regex
  pickaxe: assert that we must have a needle under -G or -S
  pickaxe: refactor function selection in diffcore-pickaxe()
  perf: add performance test for pickaxe
  pickaxe/style: consolidate declarations and assignments
  diff.h: move pickaxe fields together again
  pickaxe: die when --find-object and --pickaxe-all are combined
  pickaxe: die when -G and --pickaxe-regex are combined
  pickaxe tests: add missing test for --no-pickaxe-regex being an error
  pickaxe tests: test for -G, -S and --find-object incompatibility
  pickaxe tests: add test for "log -S" not being a regex
  pickaxe tests: add test for diffgrep_consume() internals
  ...

4 years agoMerge branch 'tv/p4-fallback-encoding' into jch
Junio C Hamano [Thu, 17 Jun 2021 02:26:16 +0000 (11:26 +0900)] 
Merge branch 'tv/p4-fallback-encoding' into jch

"git p4" learns the fallbackEncoding configuration variable to
safely accept changeset descriptions that aren't written in UTF-8.

* tv/p4-fallback-encoding:
  git-p4: git-p4.fallbackEncoding to specify non UTF-8 charset

4 years agoMerge branch 'hn/prep-tests-for-reftable' into jch
Junio C Hamano [Thu, 17 Jun 2021 02:26:16 +0000 (11:26 +0900)] 
Merge branch 'hn/prep-tests-for-reftable' into jch

Preliminary clean-up of tests before the main reftable changes
hits the codebase.

* hn/prep-tests-for-reftable: (22 commits)
  t1415: set REFFILES for test specific to storage format
  t4202: mark bogus head hash test with REFFILES
  t7003: check reflog existence only for REFFILES
  t7900: stop checking for loose refs
  t1404: mark tests that muck with .git directly as REFFILES.
  t2017: mark --orphan/logAllRefUpdates=false test as REFFILES
  t1414: mark corruption test with REFFILES
  t1407: require REFFILES for for_each_reflog test
  test-lib: provide test prereq REFFILES
  t5304: use "reflog expire --all" to clear the reflog
  t5304: restyle: trim empty lines, drop ':' before >
  t7003: use rev-parse rather than FS inspection
  t5000: inspect HEAD using git-rev-parse
  t5000: reformat indentation to the latest fashion
  t1301: fix typo in error message
  t1413: use tar to save and restore entire .git directory
  t1401-symbolic-ref: avoid direct filesystem access
  t1401: use tar to snapshot and restore repo state
  t5601: read HEAD using rev-parse
  t9300: check ref existence using test-helper rather than a file system check
  ...

4 years agoMerge branch 'fc/push-simple-updates-cleanup' into jch
Junio C Hamano [Thu, 17 Jun 2021 02:26:16 +0000 (11:26 +0900)] 
Merge branch 'fc/push-simple-updates-cleanup' into jch

Some more code and doc clarification around "git push".

* fc/push-simple-updates-cleanup:
  push: don't get a full remote object
  push: only check same_remote when needed
  push: remove trivial function
  push: remove redundant check
  push: factor out the typical case
  push: get rid of all the setup_push_* functions
  push: trivial simplifications
  push: make setup_push_* return the dst
  push: only get the branch when needed
  push: factor out null branch check
  push: split switch cases
  push: return immediately in trivial switch case
  push: create new get_upstream_ref() helper

4 years agoMerge branch 'fc/push-simple-updates' into jch
Junio C Hamano [Thu, 17 Jun 2021 02:26:15 +0000 (11:26 +0900)] 
Merge branch 'fc/push-simple-updates' into jch

Some code and doc clarification around "git push".

* fc/push-simple-updates:
  doc: push: explain default=simple correctly
  push: remove unused code in setup_push_upstream()
  push: simplify setup_push_simple()
  push: reorganize setup_push_simple()
  push: copy code to setup_push_simple()
  push: hedge code of default=simple
  push: rename !triangular to same_remote

4 years agoMerge branch 'js/trace2-discard-event-docfix' into jch
Junio C Hamano [Thu, 17 Jun 2021 02:26:13 +0000 (11:26 +0900)] 
Merge branch 'js/trace2-discard-event-docfix' into jch

Docfix.

* js/trace2-discard-event-docfix:
  docs: fix api-trace2 doc for "too_many_files" event

4 years agoMerge branch 'tb/complete-diff-anchored' into jch
Junio C Hamano [Thu, 17 Jun 2021 02:26:12 +0000 (11:26 +0900)] 
Merge branch 'tb/complete-diff-anchored' into jch

The command line completion (in contrib/) learned that "git diff"
takes the "--anchored" option.

* tb/complete-diff-anchored:
  completion: add --anchored to diff's options

4 years agoMerge branch 'tk/partial-clone-repack-doc' into jch
Junio C Hamano [Thu, 17 Jun 2021 02:26:12 +0000 (11:26 +0900)] 
Merge branch 'tk/partial-clone-repack-doc' into jch

Docfix.

* tk/partial-clone-repack-doc:
  Remove warning that repack only works on non-promisor packfiles

4 years agouserdiff: add support for C# record types
Julian Verdurmen [Tue, 2 Mar 2021 00:58:09 +0000 (00:58 +0000)] 
userdiff: add support for C# record types

Records are added in C# 9

Code example :

    public record Person(string FirstName, string LastName);

For more information, see:
* https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-9

Signed-off-by: Julian Verdurmen <julian.verdurmen@outlook.com>
Reviewed-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoSQUASH??? replace neutering tips with that of Æver
Junio C Hamano [Wed, 16 Jun 2021 05:04:49 +0000 (14:04 +0900)] 
SQUASH??? replace neutering tips with that of Æver

4 years agoCodingGuidelines: recommend singular they
Derrick Stolee [Tue, 15 Jun 2021 14:11:12 +0000 (14:11 +0000)] 
CodingGuidelines: recommend singular they

Technical writing seeks to convey information with minimal friction. One
way that a reader can experience friction is if they encounter a
description of "a user" that is later simplified using a gendered
pronoun. If the reader does not consider that pronoun to apply to them,
then they can experience cognitive dissonance that removes focus from
the information.

When choosing a gendered pronoun, that pronoun no longer applies to
nearly half of possible readers. Even if we alternated between "he/him"
and "she/her" perfectly evenly, we would still expect male and female
readers to experience an incorrect pronoun half the time. However, some
readers will not prescribe to either of these binary genders. Those
readers hence suffer an incorrect pronoun the entire time.

To make our documentation more inclusive, add recommendations to the
CodingGuidelines document. We can refer to this section when a
contributor submits a patch with a gendered pronoun and these
recommendations apply. The examples can assist in producing a new patch
with adjusted language.

As noted in the guidelines, removing an example person can make the
writing clearer and more concise. Other techniques such as singular
"you" and plural "they" are widely accepted ways to adjust the noun and
avoid gendered pronouns. Finally, an author can resort to singluar
"they" if absolutely necessary, but this can be difficult for readers
who learned English in a way that dictated "they" as always plural.

If we refer to a specific person, then using a gendered pronoun is
appropriate. There can also be other cases where it is inappropriate for
us to update the existing examples within the Git codebase, such as:

* References to real people (e.g. Linus Torvalds, "the Git maintainer").
  Do not misgender real people. If there is any doubt to the gender of a
  person, then avoid using pronouns.

* References to fictional people with clear genders (e.g. Alice and
  Bob).

* Sample text used in test cases (e.g t3702, t6432).

* The official text of the GPL license contains uses of "he or she", but
  modifying the license this way is not within the scope of the Git
  project.

* Literal email messages in Documentation/howto/ should not be edited
  for grammatical concerns such as this, unless we update the entire
  document to fit the standard documentation format. If such an effort is
  taken on, then the authorship would change and no longer refer to the
  exact mail message.

* External projects consumed in contrib/ should not deviate solely for
  style reasons. Recommended edits should be contributed to those
  projects directly.

Other cases within the Git project were cleaned up by the previous
changes.

Co-authored-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years ago*: fix typos
Derrick Stolee [Tue, 15 Jun 2021 14:11:11 +0000 (14:11 +0000)] 
*: fix typos

These typos were found while searching the codebase for gendered
pronouns. In the case of t9300-fast-import.sh, remove a confusing
comment that is unnecessary to the understanding of the test.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agocomments: avoid using the gender of our users
Felipe Contreras [Tue, 15 Jun 2021 14:11:10 +0000 (14:11 +0000)] 
comments: avoid using the gender of our users

We generally avoid specifying the gender of our users in order to be
more inclusive, but sometimes a few slip by due to habit.

Since by doing a little bit of rewording we can avoid this irrelevant
detail, let's do so.

Inspired-by: Derrick Stolee <dstolee@microsoft.com>
Helped-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agodoc: avoid using the gender of other people
Felipe Contreras [Tue, 15 Jun 2021 14:11:09 +0000 (14:11 +0000)] 
doc: avoid using the gender of other people

Using gendered pronouns for an anonymous person applies a gender where
none is known and further excludes readers who do not use gendered
pronouns. Avoid such examples in the documentation by using "they" or
passive voice to avoid the need for a pronoun.

Inspired-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agogc tests: add a test for the "pre-auto-gc" hook
Ævar Arnfjörð Bjarmason [Mon, 14 Jun 2021 10:39:25 +0000 (12:39 +0200)] 
gc tests: add a test for the "pre-auto-gc" hook

Add a missing test for the behavior of the pre-auto-gc hook added in
0b85d92661e (Documentation/hooks: add pre-auto-gc hook, 2008-04-02).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agopre-commit hook tests: don't leave "actual" nonexisting on failure
Ævar Arnfjörð Bjarmason [Mon, 14 Jun 2021 10:37:35 +0000 (12:37 +0200)] 
pre-commit hook tests: don't leave "actual" nonexisting on failure

Start by creating an "actual" file in a core.hooksPath test that has
the hook echoing to the "actual" file.

We later test_cmp that file to see what hooks were run. If we fail to
run our hook(s) we'll have an empty list of hooks for the test_cmp
instead of a nonexisting file. For the logic of this test that makes more sense.

See 867ad08a261 (hooks: allow customizing where the hook directory is,
2016-05-04) for the commit that added these tests.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agosubmodule--helper: introduce add-config subcommand
Atharva Raykar [Tue, 15 Jun 2021 14:57:45 +0000 (20:27 +0530)] 
submodule--helper: introduce add-config subcommand

Add a new "add-config" subcommand to `git submodule--helper` with the
goal of converting part of the shell code in git-submodule.sh related to
`git submodule add` into C code. This new subcommand sets the
configuration variables of a newly added submodule, by registering the
url in local git config, as well as the submodule name and path in the
.gitmodules file. It also sets 'submodule.<name>.active' to "true" if
the submodule path has not already been covered by any pathspec
specified in 'submodule.active'.

This is meant to be a faithful conversion from shell to C, with only one
minor change: A warning is emitted if no value is specified in
'submodule.active', ie, the config looks like: "[submodule] active\n",
because it is an invalid configuration. It would be helpful to let the
user know that the pathspec is unset, and the value of
'submodule.<name>.active' might be set to 'true' so that they can
rectify their configuration and prevent future surprises (especially
given that the latter variable has a higher priority than the former).

The structure of the conditional to check if we need to set the 'active'
toggle looks different from the shell version -- but behaves the same.
The change was made to decrease code duplication. A comment has been
added to explain that only one value of 'submodule.active' is obtained
to check if we need to call is_submodule_active() at all.

This is part of a series of changes that will result in all of
'submodule add' being converted to C.

Signed-off-by: Atharva Raykar <raykar.ath@gmail.com>
Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Shourya Shukla <shouryashukla.oo@gmail.com>
Based-on-patch-by: Shourya Shukla <shouryashukla.oo@gmail.com>
Based-on-patch-by: Prathamesh Chavan <pc44800@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agosubmodule--helper: introduce add-clone subcommand
Atharva Raykar [Tue, 15 Jun 2021 14:57:44 +0000 (20:27 +0530)] 
submodule--helper: introduce add-clone subcommand

Let's add a new "add-clone" subcommand to `git submodule--helper` with
the goal of converting part of the shell code in git-submodule.sh
related to `git submodule add` into C code. This new subcommand clones
the repository that is to be added, and checks out to the appropriate
branch.

This is meant to be a faithful conversion that leaves the behaviour of
'submodule add' unchanged. The only minor change is that if a submodule name has
been supplied with a name that clashes with a local submodule, the message shown
to the user ("A git directory for 'foo' is found locally...") is prepended with
"error" for clarity.

This is part of a series of changes that will result in all of 'submodule add'
being converted to C.

Signed-off-by: Atharva Raykar <raykar.ath@gmail.com>
Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Shourya Shukla <shouryashukla.oo@gmail.com>
Based-on-patch-by: Shourya Shukla <shouryashukla.oo@gmail.com>
Based-on-patch-by: Prathamesh Chavan <pc44800@gmail.com>
Helped-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agosubmodule--helper: refactor module_clone()
Atharva Raykar [Tue, 15 Jun 2021 14:57:43 +0000 (20:27 +0530)] 
submodule--helper: refactor module_clone()

Separate out the core logic of module_clone() from the flag
parsing---this way we can call the equivalent of the `submodule--helper
clone` subcommand directly within C, without needing to push arguments
in a strvec.

Signed-off-by: Atharva Raykar <raykar.ath@gmail.com>
Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Shourya Shukla <shouryashukla.oo@gmail.com>
Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agograph: improve grammar of "invalid color" error message
Alex Henrie [Sat, 12 Jun 2021 18:41:44 +0000 (12:41 -0600)] 
graph: improve grammar of "invalid color" error message

Without the "d", it sounds like a command, not an error, and is liable
to be translated incorrectly.

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoshow-branch tests: add missing tests
Ævar Arnfjörð Bjarmason [Mon, 14 Jun 2021 17:18:10 +0000 (19:18 +0200)] 
show-branch tests: add missing tests

Add missing tests for --remotes, --list and --merge-base. These are
not exhaustive, but better than the nothing we have now.

There were some tests for this command added in f76412ed6db ([PATCH]
Add 'git show-branch'., 2005-08-21) has never been properly tested,
namely for the --all option in t6432-merge-recursive-space-options.sh,
and some of --merge-base and --independent in t6010-merge-base.sh.

This fixes a few more blind spots, but there's still a lot of behavior
that's not tested for.

These new tests show the add (and possibly unintentional) behavior of
--merge-base with one argument, and how its output is the same as "git
merge-base" with N bases in this particular case. See the test added
in f621a8454d1 (git-merge-base/git-show-branch --merge-base:
Documentation and test, 2009-08-05) for a case where the two aren't
the same.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoshow-branch: fix and test --color output
Ævar Arnfjörð Bjarmason [Mon, 14 Jun 2021 17:18:09 +0000 (19:18 +0200)] 
show-branch: fix and test --color output

Fix the "show-branch --color" output so it doesn't needlessly color
and reset each time it emits a space character.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoshow-branch tests: modernize test code
Ævar Arnfjörð Bjarmason [Mon, 14 Jun 2021 17:18:08 +0000 (19:18 +0200)] 
show-branch tests: modernize test code

Modernize test code added in ce567d1867a (Add test to show that
show-branch misses out the 8th column, 2008-07-23) and
11ee57bc4c4 (sort_in_topological_order(): avoid setting a commit flag,
2008-07-23) to use test helpers.

I'm renaming "out" to "actual" for consistency with other tests, and
introducing a "branches.sorted" file in the setup, to make it clear
that it's important that the list be sorted in this particular way.

The "show-branch" output is indented with spaces, which would cause
complaints under "git show --check" with an indented here-doc
block. Let's prefix the lines with "> " to work around that, and to
make it clear that the leading whitespace is important.

We can also get rid of the hardcoding of "main" added here in
334afbc76fb (tests: mark tests relying on the current default for
`init.defaultBranch`, 2020-11-18). For this test we're setting up an
"initial" commit anyway, and now that we've moved over to test_commit
we can reference that instead.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoshow-branch tests: rename the one "show-branch" test file
Ævar Arnfjörð Bjarmason [Mon, 14 Jun 2021 17:18:07 +0000 (19:18 +0200)] 
show-branch tests: rename the one "show-branch" test file

Rename the only *show-branch* test file to indicate that more tests
belong it in than just the one-off octopus test it now contains.

The test was initially added in ce567d1867a (Add test to show that
show-branch misses out the 8th column, 2008-07-23) and
11ee57bc4c4 (sort_in_topological_order(): avoid setting a commit flag,
2008-07-23). Those two add almost the same content, one with a
test_expect_success and the other a test_expect_failure (a bug being
tested for was fixed on one of the branches).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agobuiltin/checkout--worker: zero-initialise struct to avoid MSAN complaints
Andrzej Hunt [Mon, 14 Jun 2021 15:51:16 +0000 (15:51 +0000)] 
builtin/checkout--worker: zero-initialise struct to avoid MSAN complaints

report_result() sends a struct to the parent process, but that struct
would contain uninitialised padding bytes. Running this code under MSAN
rightly triggers a warning - but we don't particularly care about this
warning because we control the receiving code, and we therefore know
that those padding bytes won't be read on the receiving end.

We could simply suppress this warning under MSAN with the approporiate
ifdef'd attributes, but a less intrusive solution is to 0-initialise the
struct, which guarantees that the padding will also be initialised.

Interestingly, in the error-case branch, we only try to copy the first
two members of pc_item_result, by copying only PC_ITEM_RESULT_BASE_SIZE
bytes. However PC_ITEM_RESULT_BASE_SIZE is defined as
'offsetof(the_last_member)', which means that we're copying padding bytes
after the end of the second last member. We could avoid doing this by
redefining PC_ITEM_RESULT_BASE_SIZE as
'offsetof(second_last_member) + sizeof(second_last_member)', but there's
no huge benefit to doing so (and this patch silences the MSAN warning in
this scenario either way).

MSAN output from t2080 (partially interleaved due to the
parallel work :) ):

Uninitialized bytes in __interceptor_write at offset 12 inside [0x7fff37d83408, 160)
==23279==WARNING: MemorySanitizer: use-of-uninitialized-value
Uninitialized bytes in __interceptor_write at offset 12 inside [0x7ffdb8a07ec8, 160)
==23280==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0xd5ac28 in xwrite /home/ahunt/git/git/wrapper.c:256:8
    #1 0xd5b327 in write_in_full /home/ahunt/git/git/wrapper.c:311:21
    #2 0xb0a8c4 in do_packet_write /home/ahunt/git/git/pkt-line.c:221:6
    #3 0xb0a5fd in packet_write /home/ahunt/git/git/pkt-line.c:242:6
    #4 0x4f7441 in report_result /home/ahunt/git/git/builtin/checkout--worker.c:69:2
    #5 0x4f6be6 in worker_loop /home/ahunt/git/git/builtin/checkout--worker.c:100:3
    #6 0x4f68d3 in cmd_checkout__worker /home/ahunt/git/git/builtin/checkout--worker.c:143:2
    #7 0x4a1e76 in run_builtin /home/ahunt/git/git/git.c:461:11
    #8 0x49e1e7 in handle_builtin /home/ahunt/git/git/git.c:714:3
    #9 0x4a0c08 in run_argv /home/ahunt/git/git/git.c:781:4
    #10 0x49d5a8 in cmd_main /home/ahunt/git/git/git.c:912:19
    #11 0x7974da in main /home/ahunt/git/git/common-main.c:52:11
    #12 0x7f8778114349 in __libc_start_main (/lib64/libc.so.6+0x24349)
    #13 0x421bd9 in _start /home/abuild/rpmbuild/BUILD/glibc-2.26/csu/../sysdeps/x86_64/start.S:120

  Uninitialized value was created by an allocation of 'res' in the stack frame of function 'report_result'
    #0 0x4f72c0 in report_result /home/ahunt/git/git/builtin/checkout--worker.c:55

SUMMARY: MemorySanitizer: use-of-uninitialized-value /home/ahunt/git/git/wrapper.c:256:8 in xwrite
Exiting
    #0 0xd5ac28 in xwrite /home/ahunt/git/git/wrapper.c:256:8
    #1 0xd5b327 in write_in_full /home/ahunt/git/git/wrapper.c:311:21
    #2 0xb0a8c4 in do_packet_write /home/ahunt/git/git/pkt-line.c:221:6
    #3 0xb0a5fd in packet_write /home/ahunt/git/git/pkt-line.c:242:6
    #4 0x4f7441 in report_result /home/ahunt/git/git/builtin/checkout--worker.c:69:2
    #5 0x4f6be6 in worker_loop /home/ahunt/git/git/builtin/checkout--worker.c:100:3
    #6 0x4f68d3 in cmd_checkout__worker /home/ahunt/git/git/builtin/checkout--worker.c:143:2
    #7 0x4a1e76 in run_builtin /home/ahunt/git/git/git.c:461:11
    #8 0x49e1e7 in handle_builtin /home/ahunt/git/git/git.c:714:3
    #9 0x4a0c08 in run_argv /home/ahunt/git/git/git.c:781:4
    #10 0x49d5a8 in cmd_main /home/ahunt/git/git/git.c:912:19
    #11 0x7974da in main /home/ahunt/git/git/common-main.c:52:11
    #12 0x7f2749a0e349 in __libc_start_main (/lib64/libc.so.6+0x24349)
    #13 0x421bd9 in _start /home/abuild/rpmbuild/BUILD/glibc-2.26/csu/../sysdeps/x86_64/start.S:120

  Uninitialized value was created by an allocation of 'res' in the stack frame of function 'report_result'
    #0 0x4f72c0 in report_result /home/ahunt/git/git/builtin/checkout--worker.c:55

SUMMARY: MemorySanitizer: use-of-uninitialized-value /home/ahunt/git/git/wrapper.c:256:8 in xwrite

Signed-off-by: Andrzej Hunt <andrzej@ahunt.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agosplit-index: use oideq instead of memcmp to compare object_id's
Andrzej Hunt [Mon, 14 Jun 2021 15:51:15 +0000 (15:51 +0000)] 
split-index: use oideq instead of memcmp to compare object_id's

cache_entry contains an object_id, and compare_ce_content() would
include that field when calling memcmp on a subset of the cache_entry.
Depending on which hashing algorithm is being used, only part of
object_id.hash is actually being used, therefore including it in a
memcmp() is incorrect. Instead we choose to exclude the object_id when
calling memcmp(), and call oideq() separately.

This issue was found when running t1700-split-index with MSAN, see MSAN
output below (on my machine, offset 76 corresponds to 4 bytes after the
start of object_id.hash).

Uninitialized bytes in MemcmpInterceptorCommon at offset 76 inside [0x7f60e7c00118, 92)
==27914==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x4524ee in memcmp /home/abuild/rpmbuild/BUILD/llvm-11.0.0.src/build/../projects/compiler-rt/lib/msan/../sanitizer_common/sanitizer_common_interceptors.inc:873:10
    #1 0xc867ae in compare_ce_content /home/ahunt/git/git/split-index.c:208:8
    #2 0xc859fb in prepare_to_write_split_index /home/ahunt/git/git/split-index.c:336:9
    #3 0xb4bbca in write_split_index /home/ahunt/git/git/read-cache.c:3107:2
    #4 0xb42b4d in write_locked_index /home/ahunt/git/git/read-cache.c:3295:8
    #5 0x638058 in try_merge_strategy /home/ahunt/git/git/builtin/merge.c:758:7
    #6 0x63057f in cmd_merge /home/ahunt/git/git/builtin/merge.c:1663:9
    #7 0x4a1e76 in run_builtin /home/ahunt/git/git/git.c:461:11
    #8 0x49e1e7 in handle_builtin /home/ahunt/git/git/git.c:714:3
    #9 0x4a0c08 in run_argv /home/ahunt/git/git/git.c:781:4
    #10 0x49d5a8 in cmd_main /home/ahunt/git/git/git.c:912:19
    #11 0x7974da in main /home/ahunt/git/git/common-main.c:52:11
    #12 0x7f60e928e349 in __libc_start_main (/lib64/libc.so.6+0x24349)
    #13 0x421bd9 in _start /home/abuild/rpmbuild/BUILD/glibc-2.26/csu/../sysdeps/x86_64/start.S:120

  Uninitialized value was stored to memory at
    #0 0x447eb9 in __msan_memcpy /home/abuild/rpmbuild/BUILD/llvm-11.0.0.src/build/../projects/compiler-rt/lib/msan/msan_interceptors.cpp:1558:3
    #1 0xb4d1e6 in dup_cache_entry /home/ahunt/git/git/read-cache.c:3457:2
    #2 0xd214fa in add_entry /home/ahunt/git/git/unpack-trees.c:215:18
    #3 0xd1fae0 in keep_entry /home/ahunt/git/git/unpack-trees.c:2276:2
    #4 0xd1ff9e in twoway_merge /home/ahunt/git/git/unpack-trees.c:2504:11
    #5 0xd27028 in call_unpack_fn /home/ahunt/git/git/unpack-trees.c:593:12
    #6 0xd2443d in unpack_nondirectories /home/ahunt/git/git/unpack-trees.c:1106:12
    #7 0xd19435 in unpack_callback /home/ahunt/git/git/unpack-trees.c:1306:6
    #8 0xd0d7ff in traverse_trees /home/ahunt/git/git/tree-walk.c:532:17
    #9 0xd1773a in unpack_trees /home/ahunt/git/git/unpack-trees.c:1683:9
    #10 0xdc6370 in checkout /home/ahunt/git/git/merge-ort.c:3590:8
    #11 0xdc51c3 in merge_switch_to_result /home/ahunt/git/git/merge-ort.c:3728:7
    #12 0xa195a9 in merge_ort_recursive /home/ahunt/git/git/merge-ort-wrappers.c:58:2
    #13 0x637fff in try_merge_strategy /home/ahunt/git/git/builtin/merge.c:751:12
    #14 0x63057f in cmd_merge /home/ahunt/git/git/builtin/merge.c:1663:9
    #15 0x4a1e76 in run_builtin /home/ahunt/git/git/git.c:461:11
    #16 0x49e1e7 in handle_builtin /home/ahunt/git/git/git.c:714:3
    #17 0x4a0c08 in run_argv /home/ahunt/git/git/git.c:781:4
    #18 0x49d5a8 in cmd_main /home/ahunt/git/git/git.c:912:19
    #19 0x7974da in main /home/ahunt/git/git/common-main.c:52:11

  Uninitialized value was created by a heap allocation
    #0 0x44e73d in malloc /home/abuild/rpmbuild/BUILD/llvm-11.0.0.src/build/../projects/compiler-rt/lib/msan/msan_interceptors.cpp:901:3
    #1 0xd592f6 in do_xmalloc /home/ahunt/git/git/wrapper.c:41:8
    #2 0xd59248 in xmalloc /home/ahunt/git/git/wrapper.c:62:9
    #3 0xa17088 in mem_pool_alloc_block /home/ahunt/git/git/mem-pool.c:22:6
    #4 0xa16f78 in mem_pool_init /home/ahunt/git/git/mem-pool.c:44:3
    #5 0xb481b8 in load_all_cache_entries /home/ahunt/git/git/read-cache.c
    #6 0xb44d40 in do_read_index /home/ahunt/git/git/read-cache.c:2298:17
    #7 0xb48a1b in read_index_from /home/ahunt/git/git/read-cache.c:2389:8
    #8 0xbd5a0b in repo_read_index /home/ahunt/git/git/repository.c:276:8
    #9 0xb4bcaf in repo_read_index_unmerged /home/ahunt/git/git/read-cache.c:3326:2
    #10 0x62ed26 in cmd_merge /home/ahunt/git/git/builtin/merge.c:1362:6
    #11 0x4a1e76 in run_builtin /home/ahunt/git/git/git.c:461:11
    #12 0x49e1e7 in handle_builtin /home/ahunt/git/git/git.c:714:3
    #13 0x4a0c08 in run_argv /home/ahunt/git/git/git.c:781:4
    #14 0x49d5a8 in cmd_main /home/ahunt/git/git/git.c:912:19
    #15 0x7974da in main /home/ahunt/git/git/common-main.c:52:11
    #16 0x7f60e928e349 in __libc_start_main (/lib64/libc.so.6+0x24349)

SUMMARY: MemorySanitizer: use-of-uninitialized-value /home/abuild/rpmbuild/BUILD/llvm-11.0.0.src/build/../projects/compiler-rt/lib/msan/../sanitizer_common/sanitizer_common_interceptors.inc:873:10 in memcmp
Exiting

Signed-off-by: Andrzej Hunt <andrzej@ahunt.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agomktag tests: test fast-export
Ævar Arnfjörð Bjarmason [Mon, 14 Jun 2021 17:28:23 +0000 (19:28 +0200)] 
mktag tests: test fast-export

Pass the bad tags we've created in the mktag tests through
fast-export, it will die on the bad object or ref, let's make sure
that happens.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agomktag tests: test for-each-ref
Ævar Arnfjörð Bjarmason [Mon, 14 Jun 2021 17:28:22 +0000 (19:28 +0200)] 
mktag tests: test for-each-ref

Add a "for-each-ref" for all the mktag tests. This test would have
caught the segfault which was fixed in c6854508808 (ref-filter: fix
NULL check for parse object failure, 2021-04-01). Let's make sure we
test that code more exhaustively.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agomktag tests: test update-ref and reachable fsck
Ævar Arnfjörð Bjarmason [Mon, 14 Jun 2021 17:28:21 +0000 (19:28 +0200)] 
mktag tests: test update-ref and reachable fsck

Extend the mktag tests to pass the created bad tag through update-ref
and fsck.

The reason for passing it through update-ref is to guard against it
having a segfault as for-each-ref did before c6854508808 (ref-filter:
fix NULL check for parse object failure, 2021-04-01).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agomktag tests: test hash-object --literally and unreachable fsck
Ævar Arnfjörð Bjarmason [Mon, 14 Jun 2021 17:28:20 +0000 (19:28 +0200)] 
mktag tests: test hash-object --literally and unreachable fsck

Extend the mktag tests to pass the tag we've created through both
hash-object --literally and fsck.

This checks that fsck itself will not complain about certain invalid
content if a reachable tip isn't involved. Due to how fsck works and
walks the graph the failure will be different if the object is
reachable, so we might succeed before we've created the ref.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agomktag tests: invert --no-strict test
Ævar Arnfjörð Bjarmason [Mon, 14 Jun 2021 17:28:19 +0000 (19:28 +0200)] 
mktag tests: invert --no-strict test

Change the mktag --no-strict test to actually test success under
--no-strict, that test was added in 06ce79152be (mktag: add a
--[no-]strict option, 2021-01-06).

It doesn't make sense to check that we have the same failure except
when we want --no-strict, by doing that we're assuming that the
behavior will be different under --no-strict, bun nothing was testing
for that.

We should instead assert that --strict is the same as --no-strict,
except in the cases where we've declared that it's not.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agomktag tests: parse out options in helper
Ævar Arnfjörð Bjarmason [Mon, 14 Jun 2021 17:28:18 +0000 (19:28 +0200)] 
mktag tests: parse out options in helper

Change check_verify_failure() helper to parse out options from
$@. This makes it easier to add new options in the future. See
06ce79152be (mktag: add a --[no-]strict option, 2021-01-06) for the
initial implementation.

Let's also replace "" quotes with '' for the test body, the varables
we need are eval'd into the body, so there's no need for the quoting
confusion.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agosubtree: fix assumption about the directory separator
Johannes Schindelin [Mon, 14 Jun 2021 12:41:53 +0000 (12:41 +0000)] 
subtree: fix assumption about the directory separator

On Windows, both forward and backslash are valid separators. In
22d550749361 (subtree: don't fuss with PATH, 2021-04-27), however, we
added code that assumes that it can only be the forward slash.

Let's fix that.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agosubtree: fix the GIT_EXEC_PATH sanity check to work on Windows
Johannes Schindelin [Mon, 14 Jun 2021 12:41:52 +0000 (12:41 +0000)] 
subtree: fix the GIT_EXEC_PATH sanity check to work on Windows

In 22d550749361 (subtree: don't fuss with PATH, 2021-04-27), `git
subtree` was broken thoroughly on Windows.

The reason is that it assumes Unix semantics, where `PATH` is
colon-separated, and it assumes that `$GIT_EXEC_PATH:` is a verbatim
prefix of `$PATH`. Neither are true, the latter in particular because
`GIT_EXEC_PATH` is a Windows-style path, while `PATH` is a Unix-style
path list.

Let's make extra certain that `$GIT_EXEC_PATH` and the first component
of `$PATH` refer to different entities before erroring out.

We do that by using the `test <path1> -ef <path2>` command that verifies
that the inode of `<path1>` and of `<path2>` is the same.

Sadly, this construct is non-portable, according to
https://pubs.opengroup.org/onlinepubs/009695399/utilities/test.html.
However, it does not matter in practice because we still first look
whether `$GIT_EXEC_PREFIX` is string-identical to the first component of
`$PATH`. This will give us the expected result everywhere but in Git for
Windows, and Git for Windows' own Bash _does_ handle the `-ef` operator.

Just in case that we _do_ need to show the error message _and_ are
running in a shell that lacks support for `-ef`, we simply suppress the
error output for that part.

This fixes https://github.com/git-for-windows/git/issues/3260

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agobitmaps: don't recurse into trees already in the bitmap
Jeff King [Mon, 14 Jun 2021 12:05:44 +0000 (08:05 -0400)] 
bitmaps: don't recurse into trees already in the bitmap

If an object is already mentioned in a reachability bitmap we are
building, then by definition so are all of the objects it can reach. We
have an optimization to stop traversing commits when we see they are
already in the bitmap, but we don't do the same for trees.

It's generally unavoidable to recurse into trees for commits not yet
covered by bitmaps (since most commits generally do have unique
top-level trees). But they usually have subtrees that are shared with
other commits (i.e., all of the subtrees the commit _didn't_ touch). And
some of those commits (and their trees) may be covered by the bitmap.

Usually this isn't _too_ big a deal, because we'll visit those subtrees
only once in total for the whole walk. But if you have a large number of
unbitmapped commits, and if your tree is big, then you may end up
opening a lot of sub-trees for no good reason.

We can use the same optimization we do for commits here: when we are
about to open a tree, see if it's in the bitmap (either the one we are
building, or the "seen" bitmap which covers the UNINTERESTING side of
the bitmap when doing a set-difference).

This works especially well because we'll visit all commits before
hitting any trees. So even in a history like:

  A -- B

if "A" has a bitmap on disk but "B" doesn't, we'll already have OR-ed in
the results from A before looking at B's tree (so we really will only
look at trees touched by B).

For most repositories, the timings produced by p5310 are unspectacular.
Here's linux.git:

  Test                         HEAD^             HEAD
  --------------------------------------------------------------------
  5310.4: simulated clone      6.00(5.90+0.10)   5.98(5.90+0.08) -0.3%
  5310.5: simulated fetch      2.98(5.45+0.18)   2.85(5.31+0.18) -4.4%
  5310.7: rev-list (commits)   0.32(0.29+0.03)   0.33(0.30+0.03) +3.1%
  5310.8: rev-list (objects)   1.48(1.44+0.03)   1.49(1.44+0.05) +0.7%

Any improvement there is within the noise (the +3.1% on test 7 has to be
noise, since we are not recursing into trees, and thus the new code
isn't even run). The results for git.git are likewise uninteresting.

But here are numbers from some other real-world repositories (that are
not public). This one's tree is comparable in size to linux.git, but has
~16k refs (and so less complete bitmap coverage):

  Test                         HEAD^               HEAD
  -------------------------------------------------------------------------
  5310.4: simulated clone      38.34(39.86+0.74)   33.95(35.53+0.76) -11.5%
  5310.5: simulated fetch      2.29(6.31+0.35)     2.20(5.97+0.41) -3.9%
  5310.7: rev-list (commits)   0.99(0.86+0.13)     0.96(0.85+0.11) -3.0%
  5310.8: rev-list (objects)   11.32(11.04+0.27)   6.59(6.37+0.21) -41.8%

And here's another with a very large tree (~340k entries), and a fairly
large number of refs (~10k):

  Test                         HEAD^               HEAD
  -------------------------------------------------------------------------
  5310.3: simulated clone      53.83(54.71+1.54)   39.77(40.76+1.50) -26.1%
  5310.4: simulated fetch      19.91(20.11+0.56)   19.79(19.98+0.67) -0.6%
  5310.6: rev-list (commits)   0.54(0.44+0.11)     0.51(0.43+0.07) -5.6%
  5310.7: rev-list (objects)   24.32(23.59+0.73)   9.85(9.49+0.36) -59.5%

This patch provides substantial improvements in these larger cases, and
have any drawbacks for smaller ones (the cost of the bitmap check is
quite small compared to an actual tree traversal).

Note that we have to add a version of revision.c's include_check
callback which handles non-commits. We could possibly consolidate this
into a single callback for all objects types, as there's only one user
of the feature which would need converted (pack-bitmap.c:should_include).
That would in theory let us avoid duplicating any logic. But when I
tried it, the code ended up much worse to read, with lots of repeated
"if it's a commit do this, otherwise do that". Having two separate
callbacks splits that naturally, and matches the existing split of
show_commit/show_object callbacks.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agopull: trivial whitespace style fix
Felipe Contreras [Sun, 13 Jun 2021 04:59:49 +0000 (23:59 -0500)] 
pull: trivial whitespace style fix

Two spaces unaligned to anything is not part of the coding-style. A
single tab is.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agopull: trivial cleanup
Felipe Contreras [Sun, 13 Jun 2021 04:59:48 +0000 (23:59 -0500)] 
pull: trivial cleanup

There's no need to store ran_ff. Now it's obvious from the conditionals.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agopull: cleanup autostash check
Felipe Contreras [Sun, 13 Jun 2021 04:59:47 +0000 (23:59 -0500)] 
pull: cleanup autostash check

Currently "git pull --rebase" takes a shortcut in the case a
fast-forward merge is possible; run_merge() is called with --ff-only.

However, "git merge" didn't have an --autostash option, so, when "git
pull --rebase --autostash" was called *and* the fast-forward merge
shortcut was taken, then the pull failed.

This was fixed in commit f15e7cf5cc (pull: ff --rebase --autostash
works in dirty repo, 2017-06-01) by simply skipping the fast-forward
merge shortcut.

Later on "git merge" learned the --autostash option [a03b55530a
(merge: teach --autostash option, 2020-04-07)], and so did "git pull"
[d9f15d37f1 (pull: pass --autostash to merge, 2020-04-07)].

Therefore it's not necessary to skip the fast-forward merge shortcut
anymore when called with --rebase --autostash.

Let's always take the fast-forward merge shortcut by essentially
reverting f15e7cf5cc.

Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoThe second batch next origin/HEAD origin/master origin/next
Junio C Hamano [Mon, 14 Jun 2021 04:23:28 +0000 (13:23 +0900)] 
The second batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoMerge branch 'fc/doc-build-cleanup'
Junio C Hamano [Mon, 14 Jun 2021 04:33:29 +0000 (13:33 +0900)] 
Merge branch 'fc/doc-build-cleanup'

Preparatory build procedure clean-up for documentation.

* fc/doc-build-cleanup:
  doc: avoid using rm directly
  doc: simplify Makefile using .DELETE_ON_ERROR
  doc: remove unnecessary rm instances
  doc: improve asciidoc dependencies
  doc: refactor common asciidoc dependencies

4 years agoMerge branch 'ab/test-lib-updates'
Junio C Hamano [Mon, 14 Jun 2021 04:33:29 +0000 (13:33 +0900)] 
Merge branch 'ab/test-lib-updates'

Test clean-up.

* ab/test-lib-updates:
  test-lib: split up and deprecate test_create_repo()
  test-lib: do not show advice about init.defaultBranch under --verbose
  test-lib: reformat argument list in test_create_repo()
  submodule tests: use symbolic-ref --short to discover branch name
  test-lib functions: add --printf option to test_commit
  describe tests: convert setup to use test_commit
  test-lib functions: add an --annotated option to "test_commit"
  test-lib-functions: document test_commit --no-tag
  test-lib-functions: reword "test_commit --append" docs
  test-lib tests: remove dead GIT_TEST_FRAMEWORK_SELFTEST variable
  test-lib: bring $remove_trash out of retirement

4 years agoMerge branch 'dd/honor-users-tar-in-tests'
Junio C Hamano [Mon, 14 Jun 2021 04:33:28 +0000 (13:33 +0900)] 
Merge branch 'dd/honor-users-tar-in-tests'

Test portability fix.

* dd/honor-users-tar-in-tests:
  t: use configured TAR instead of tar

4 years agoMerge branch 'ps/rev-list-object-type-filter'
Junio C Hamano [Mon, 14 Jun 2021 04:33:28 +0000 (13:33 +0900)] 
Merge branch 'ps/rev-list-object-type-filter'

Message update.

* ps/rev-list-object-type-filter:
  help: fix small typo in error message

4 years agoMerge branch 'ab/trace2-squelch-gcc-warning'
Junio C Hamano [Mon, 14 Jun 2021 04:33:28 +0000 (13:33 +0900)] 
Merge branch 'ab/trace2-squelch-gcc-warning'

Workaround compiler warnings.

* ab/trace2-squelch-gcc-warning:
  trace2: refactor to avoid gcc warning under -O3

4 years agoMerge branch 'so/log-m-implies-p'
Junio C Hamano [Mon, 14 Jun 2021 04:33:27 +0000 (13:33 +0900)] 
Merge branch 'so/log-m-implies-p'

The "-m" option in "git log -m" that does not specify which format,
if any, of diff is desired did not have any visible effect; it now
implies some form of diff (by default "--patch") is produced.

* so/log-m-implies-p:
  diff-merges: let "-m" imply "-p"
  diff-merges: rename "combined_imply_patch" to "merges_imply_patch"
  stash list: stop passing "-m" to "git log"
  git-svn: stop passing "-m" to "git rev-list"
  diff-merges: move specific diff-index "-m" handling to diff-index
  t4013: test "git diff-index -m"
  t4013: test "git diff-tree -m"
  t4013: test "git log -m --stat"
  t4013: test "git log -m --raw"
  t4013: test that "-m" alone has no effect in "git log"

4 years agoMerge branch 'en/ort-perf-batch-11'
Junio C Hamano [Mon, 14 Jun 2021 04:33:26 +0000 (13:33 +0900)] 
Merge branch 'en/ort-perf-batch-11'

Optimize out repeated rename detection in a sequence of mergy
operations.

* en/ort-perf-batch-11:
  merge-ort, diffcore-rename: employ cached renames when possible
  merge-ort: handle interactions of caching and rename/rename(1to1) cases
  merge-ort: add helper functions for using cached renames
  merge-ort: preserve cached renames for the appropriate side
  merge-ort: avoid accidental API mis-use
  merge-ort: add code to check for whether cached renames can be reused
  merge-ort: populate caches of rename detection results
  merge-ort: add data structures for in-memory caching of rename detection
  t6429: testcases for remembering renames
  fast-rebase: write conflict state to working tree, index, and HEAD
  fast-rebase: change assert() to BUG()
  Documentation/technical: describe remembering renames optimization
  t6423: rename file within directory that other side renamed

4 years agoMerge branch 'jk/fetch-pack-v2-half-close-early'
Junio C Hamano [Mon, 14 Jun 2021 04:33:26 +0000 (13:33 +0900)] 
Merge branch 'jk/fetch-pack-v2-half-close-early'

"git fetch" over protocol v2 left its side of the socket open after
it finished speaking, which unnecessarily wasted the resource on
the other side.

* jk/fetch-pack-v2-half-close-early:
  fetch-pack: signal v2 server that we are done making requests

4 years agoMerge branch 'ds/write-index-with-hashfile-api'
Junio C Hamano [Mon, 14 Jun 2021 04:33:26 +0000 (13:33 +0900)] 
Merge branch 'ds/write-index-with-hashfile-api'

Use the hashfile API in the codepath that writes the index file to
reduce code duplication.

* ds/write-index-with-hashfile-api:
  read-cache: delete unused hashing methods
  read-cache: use hashfile instead of git_hash_ctx
  csum-file.h: increase hashfile buffer size
  hashfile: use write_in_full()

4 years agoMerge branch 'jk/clone-clean-upon-transport-error'
Junio C Hamano [Mon, 14 Jun 2021 04:33:26 +0000 (13:33 +0900)] 
Merge branch 'jk/clone-clean-upon-transport-error'

Recent "git clone" left a temporary directory behind when the
transport layer returned an failure.

* jk/clone-clean-upon-transport-error:
  clone: clean up directory after transport_fetch_refs() failure

4 years agoMerge branch 'ga/send-email-sendmail-cmd'
Junio C Hamano [Mon, 14 Jun 2021 04:33:26 +0000 (13:33 +0900)] 
Merge branch 'ga/send-email-sendmail-cmd'

"git send-email" learned the "--sendmail-cmd" command line option
and the "sendemail.sendmailCmd" configuration variable, which is a
more sensible approach than the current way of repurposing the
"smtp-server" that is meant to name the server to instead name the
command to talk to the server.

* ga/send-email-sendmail-cmd:
  git-send-email: add option to specify sendmail command

4 years agoMerge branch 'zh/ref-filter-atom-type'
Junio C Hamano [Mon, 14 Jun 2021 04:33:25 +0000 (13:33 +0900)] 
Merge branch 'zh/ref-filter-atom-type'

The code to handle the "--format" option in "for-each-ref" and
friends made too many string comparisons on %(atom)s used in the
format string, which has been corrected by converting them into
enum when the format string is parsed.

* zh/ref-filter-atom-type:
  ref-filter: introduce enum atom_type
  ref-filter: add objectsize to used_atom

4 years agomaintenance: add support for systemd timers on Linux
Lénaïc Huard [Sat, 12 Jun 2021 16:50:43 +0000 (18:50 +0200)] 
maintenance: add support for systemd timers on Linux

The existing mechanism for scheduling background maintenance is done
through cron. On Linux systems managed by systemd, systemd provides an
alternative to schedule recurring tasks: systemd timers.

The main motivations to implement systemd timers in addition to cron
are:
* cron is optional and Linux systems running systemd might not have it
  installed.
* The execution of `crontab -l` can tell us if cron is installed but not
  if the daemon is actually running.
* With systemd, each service is run in its own cgroup and its logs are
  tagged by the service inside journald. With cron, all scheduled tasks
  are running in the cron daemon cgroup and all the logs of the
  user-scheduled tasks are pretended to belong to the system cron
  service.
  Concretely, a user that doesn’t have access to the system logs won’t
  have access to the log of their own tasks scheduled by cron whereas
  they will have access to the log of their own tasks scheduled by
  systemd timer.
  Although `cron` attempts to send email, that email may go unseen by
  the user because these days, local mailboxes are not heavily used
  anymore.

In order to schedule git maintenance, we need two unit template files:
* ~/.config/systemd/user/git-maintenance@.service
  to define the command to be started by systemd and
* ~/.config/systemd/user/git-maintenance@.timer
  to define the schedule at which the command should be run.

Those units are templates that are parameterized by the frequency.

Based on those templates, 3 timers are started:
* git-maintenance@hourly.timer
* git-maintenance@daily.timer
* git-maintenance@weekly.timer

The command launched by those three timers are the same as with the
other scheduling methods:

/path/to/git for-each-repo --exec-path=/path/to
--config=maintenance.repo maintenance run --schedule=%i

with the full path for git to ensure that the version of git launched
for the scheduled maintenance is the same as the one used to run
`maintenance start`.

The timer unit contains `Persistent=true` so that, if the computer is
powered down when a maintenance task should run, the task will be run
when the computer is back powered on.

Signed-off-by: Lénaïc Huard <lenaic@lhuard.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agomaintenance: `git maintenance run` learned `--scheduler=<scheduler>`
Lénaïc Huard [Sat, 12 Jun 2021 16:50:42 +0000 (18:50 +0200)] 
maintenance: `git maintenance run` learned `--scheduler=<scheduler>`

Depending on the system, different schedulers can be used to schedule
the hourly, daily and weekly executions of `git maintenance run`:
* `launchctl` for MacOS,
* `schtasks` for Windows and
* `crontab` for everything else.

`git maintenance run` now has an option to let the end-user explicitly
choose which scheduler he wants to use:
`--scheduler=auto|crontab|launchctl|schtasks`.

When `git maintenance start --scheduler=XXX` is run, it not only
registers `git maintenance run` tasks in the scheduler XXX, it also
removes the `git maintenance run` tasks from all the other schedulers to
ensure we cannot have two schedulers launching concurrent identical
tasks.

The default value is `auto` which chooses a suitable scheduler for the
system.

`git maintenance stop` doesn't have any `--scheduler` parameter because
this command will try to remove the `git maintenance run` tasks from all
the available schedulers.

Signed-off-by: Lénaïc Huard <lenaic@lhuard.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>