git
4 years agoMerge branch 'ab/config-based-hooks-base' into seen origin/seen
Junio C Hamano [Sat, 19 Jun 2021 07:30:26 +0000 (16:30 +0900)] 
Merge branch 'ab/config-based-hooks-base' into seen

Restructuring of (a subset of) Emily's config-based-hooks series,
to demonstrate that a series can be presented as a more logical and
focused progression.

* ab/config-based-hooks-base: (30 commits)
  hook-list.h: add a generated list of hooks, like config-list.h
  hooks: fix a TOCTOU in "did we run a hook?" heuristic
  receive-pack: convert receive hooks to hook.h
  post-update: use hook.h library
  receive-pack: convert 'update' hook to hook.h
  hooks: allow callers to capture output
  run-command: allow capturing of collated output
  reference-transaction: use hook.h to run hooks
  transport: convert pre-push hook to use config
  hook: convert 'post-rewrite' hook in sequencer.c to hook.h
  hook: provide stdin by string_list or callback
  run-command: add stdin callback for parallelization
  am: convert 'post-rewrite' hook to hook.h
  hook: support passing stdin to hooks
  run-command: allow stdin for run_processes_parallel
  run-command: remove old run_hook_{le,ve}() hook API
  receive-pack: convert push-to-checkout hook to hook.h
  read-cache: convert post-index-change hook to use config
  commit: use hook.h to execute hooks
  git-p4: use 'git hook' to run hooks
  ...

4 years ago### CI breakers
Junio C Hamano [Sat, 19 Jun 2021 07:30:26 +0000 (16:30 +0900)] 
### CI breakers

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

Code clean-up around "git serve".

* ab/serve-cleanup:
  serve: use designated initializers
  transport: use designated initializers
  transport: rename "fetch" in transport_vtable to "fetch_refs"
  SQUASH??? struct strvec no longer needed
  serve: mark has_capability() as static

4 years agoMerge branch 'js/stop-exporting-bogus-columns' into seen
Junio C Hamano [Sat, 19 Jun 2021 07:30:25 +0000 (16:30 +0900)] 
Merge branch 'js/stop-exporting-bogus-columns' into seen

When we cannot figure out how wide the terminal is, we use a
fallback value of 80 ourselves (which cannot be avoided), but when
we run the pager, we export it in COLUMNS, which forces the pager
to use the hardcoded value, even when the pager is perfectly
capable to figure it out itself.  Stop exporting COLUMNS
only when building on Windows to work around this issue.

* js/stop-exporting-bogus-columns:
  pager: do not unnecessarily set COLUMNS on Windows

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

Performance tweaks of "git merge -sort" around lazy fetching of objects.

* en/ort-perf-batch-13:
  merge-ort: add prefetching for content merges
  diffcore-rename: use a different prefetch for basename comparisons
  diffcore-rename: allow different missing_object_cb functions
  t6421: add tests checking for excessive object downloads during merge
  promisor-remote: output trace2 statistics for number of objects fetched

4 years agoMerge branch 'es/superproject-aware-submodules' into seen
Junio C Hamano [Sat, 19 Jun 2021 07:30:25 +0000 (16:30 +0900)] 
Merge branch 'es/superproject-aware-submodules' into seen

A configuration variable in a submodule points at the location of
the superproject it is bound to (RFC).

* es/superproject-aware-submodules:
  SQUASH???
  submodule: cache superproject gitdir during 'update'
  submodule: cache superproject gitdir during absorbgitdirs
  introduce submodule.superprojectGitDir cache
  t7400-submodule-basic: modernize inspect() helper

4 years agoMerge branch 'ab/doc-retire-alice-bob' into seen
Junio C Hamano [Sat, 19 Jun 2021 07:30:24 +0000 (16:30 +0900)] 
Merge branch 'ab/doc-retire-alice-bob' into seen

* ab/doc-retire-alice-bob:
  pack-protocol doc: use "www-data" in place of "alice"
  doc: replace "alice" and "bob" with "jdoe" and "msmith"
  fast-import doc: change "bob" in an example to "file.txt"
  daemon doc + code comments: reword "alice" example
  gitcvs-migration doc: replace "alice" and "bob" with "you" and "www-data"
  gittutorial doc: replace "alice" and "bob" with "you" and "www-data"

4 years agoMerge branch 'pw/diff-color-moved-fix' into seen
Junio C Hamano [Sat, 19 Jun 2021 07:30:24 +0000 (16:30 +0900)] 
Merge branch 'pw/diff-color-moved-fix' into seen

Long-overdue correctness and performance update to "diff
--color-moved" feature.

* pw/diff-color-moved-fix:
  diff --color-moved: intern strings
  diff --color-moved-ws=allow-indentation-change: improve hash lookups
  diff --color-moved: stop clearing potential moved blocks
  diff --color-moved: shrink potential moved blocks as we go
  diff --color-moved: unify moved block growth functions
  diff --color-moved: call comparison function directly
  diff --color-moved-ws=allow-indentation-change: simplify and optimize
  diff: simplify allow-indentation-change delta calculation
  diff --color-moved: avoid false short line matches and bad zebra coloring
  diff --color-moved=zebra: fix alternate coloring

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

"Zealous diff3" style of merge conflict presentation has been added.

* en/zdiff3:
  update documentation for new zdiff3 conflictStyle
  xdiff: implement a zealous diff3, or "zdiff3"

4 years agoMerge branch 'ab/pack-objects-stdin' into seen
Junio C Hamano [Sat, 19 Jun 2021 07:30:24 +0000 (16:30 +0900)] 
Merge branch 'ab/pack-objects-stdin' into seen

Code clean-up.

* ab/pack-objects-stdin:
  pack-objects.c: make use of REV_INFO_STDIN_LINE_PROCESS
  pack-objects.c: do stdin parsing via revision.c's API
  revision.h: unify "disable_stdin" and "read_from_stdin"
  upload-pack: run is_repository_shallow() before setup_revisions()

4 years agoMerge branch 'dd/document-log-decorate-default' into seen
Junio C Hamano [Sat, 19 Jun 2021 07:30:23 +0000 (16:30 +0900)] 
Merge branch 'dd/document-log-decorate-default' into seen

Doc clean-up.

* dd/document-log-decorate-default:
  doc/log: correct default for --decorate

4 years agoMerge branch 'ab/update-submitting-patches' into seen
Junio C Hamano [Sat, 19 Jun 2021 07:30:23 +0000 (16:30 +0900)] 
Merge branch 'ab/update-submitting-patches' into seen

Reorganize and update the SubmitingPatches document.

* ab/update-submitting-patches:
  SubmittingPatches: remove pine-specific hints from MUA hints
  SubmittingPatches: replace discussion of Travis with GitHub Actions
  SubmittingPatches: move discussion of Signed-off-by above "send"

4 years agoMerge branch 'ab/test-tool-cache-cleanup' into seen
Junio C Hamano [Sat, 19 Jun 2021 07:30:23 +0000 (16:30 +0900)] 
Merge branch 'ab/test-tool-cache-cleanup' into seen

Test code shuffling.

* ab/test-tool-cache-cleanup:
  read-cache perf: add a perf test for refresh_index()
  test-tool: migrate read-cache-again to parse_options()
  test-tool: migrate read-cache-perf to parse_options()
  test-tool: split up test-tool read-cache

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

Test code clean-up.

* ar/test-code-cleanup:
  t: fix whitespace around &&

4 years agoMerge branch 'ba/object-info' into seen
Junio C Hamano [Sat, 19 Jun 2021 07:30:22 +0000 (16:30 +0900)] 
Merge branch 'ba/object-info' into seen

Code clean-up.

* ba/object-info:
  protocol-caps.h: add newline at end of file

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

Code clean-up.

* ab/progress-cleanup:
  read-cache.c: don't guard calls to progress.c API

4 years agoMerge branch 'ab/xdiff-bug-cleanup' into seen
Junio C Hamano [Sat, 19 Jun 2021 07:30:21 +0000 (16:30 +0900)] 
Merge branch 'ab/xdiff-bug-cleanup' into seen

Code clean-up.

* ab/xdiff-bug-cleanup:
  xdiff: use BUG(...), not xdl_bug(...)

4 years agoMerge branch 'ms/mergetools-kdiff3-on-windows' into seen
Junio C Hamano [Sat, 19 Jun 2021 07:30:21 +0000 (16:30 +0900)] 
Merge branch 'ms/mergetools-kdiff3-on-windows' into seen

On Windows, mergetool has been taught to find kdiff3.exe just like
it finds winmerge.exe.

* ms/mergetools-kdiff3-on-windows:
  mergetools/kdiff3: make kdiff3 work on Windows too

4 years agoMerge branch 'ab/send-email-optim' into seen
Junio C Hamano [Sat, 19 Jun 2021 07:30:21 +0000 (16:30 +0900)] 
Merge branch 'ab/send-email-optim' into seen

"git send-email" optimization.

* ab/send-email-optim:
  perl: nano-optimize by replacing Cwd::cwd() with Cwd::getcwd()
  send-email: move trivial config handling to Perl
  perl: lazily load some common Git.pm setup code
  send-email: lazily load modules for a big speedup
  send-email: get rid of indirect object syntax
  send-email: use function syntax instead of barewords
  send-email: lazily shell out to "git var"
  send-email: lazily load config for a big speedup
  send-email: copy "config_regxp" into git-send-email.perl
  send-email: refactor sendemail.smtpencryption config parsing
  send-email: remove non-working support for "sendemail.smtpssl"
  send-email tests: test for boolean variables without a value
  send-email tests: support GIT_TEST_PERL_FATAL_WARNINGS=true

4 years agoMerge branch 'ds/status-with-sparse-index' into seen
Junio C Hamano [Sat, 19 Jun 2021 07:30:20 +0000 (16:30 +0900)] 
Merge branch 'ds/status-with-sparse-index' into seen

"git status" codepath learned to work with sparsely populated index
without hydrating it fully.

* ds/status-with-sparse-index:
  fsmonitor: integrate with sparse index
  wt-status: expand added sparse directory entries
  status: use sparse-index throughout
  status: skip sparse-checkout percentage with sparse-index
  dir.c: accept a directory as part of cone-mode patterns
  unpack-trees: be careful around sparse directory entries
  unpack-trees: compare sparse directories correctly
  unpack-trees: preserve cache_bottom
  t1092: add tests for status/add and sparse files
  t1092: expand repository data shape
  sparse-index: include EXTENDED flag when expanding
  sparse-index: skip indexes with unmerged entries

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 agoserve: use designated initializers
Ævar Arnfjörð Bjarmason [Wed, 16 Jun 2021 14:16:20 +0000 (16:16 +0200)] 
serve: use designated initializers

Change the declaration of the protocol_capability struct to use
designated initializers, this makes this more verbose now, but a
follow-up commit will add a new field. At that point these lines would
be too dense to be on one line comfortably.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agotransport: use designated initializers
Ævar Arnfjörð Bjarmason [Wed, 16 Jun 2021 14:16:19 +0000 (16:16 +0200)] 
transport: use designated initializers

Change the assignments to the various transport_vtables to use
designated initializers, this makes the code easier to read and
maintain.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agotransport: rename "fetch" in transport_vtable to "fetch_refs"
Ævar Arnfjörð Bjarmason [Wed, 16 Jun 2021 14:16:18 +0000 (16:16 +0200)] 
transport: rename "fetch" in transport_vtable to "fetch_refs"

Rename the "fetch" member of the transport_vtable to "fetch_refs" for
consistency with the existing "push_refs". Neither of them just push
"refs" but refs and objects, but having the two match makes the code
more readable than having it be inconsistent, especially since
"fetch_refs" is a lot easier to grep for than "fetch".

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoSQUASH??? struct strvec no longer needed
Junio C Hamano [Thu, 17 Jun 2021 00:46:52 +0000 (09:46 +0900)] 
SQUASH??? struct strvec no longer needed

4 years agoserve: mark has_capability() as static
Ævar Arnfjörð Bjarmason [Wed, 16 Jun 2021 14:16:17 +0000 (16:16 +0200)] 
serve: mark has_capability() as static

The has_capability() function introduced in ed10cb952d3 (serve:
introduce git-serve, 2018-03-15) has never been used anywhere except
serve.c, so let's mark it as static.

It was later changed from "extern" in 554544276a6 (*.[ch]: remove
extern from function declarations using spatch, 2019-04-29), but we
could have simply marked it as "static" instead.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agopager: do not unnecessarily set COLUMNS on Windows
Johannes Schindelin [Wed, 16 Jun 2021 12:38:11 +0000 (12:38 +0000)] 
pager: do not unnecessarily set COLUMNS on Windows

Since https://github.com/gwsw/less/commit/bb0ee4e76c2, `less` prefers
the `COLUMNS` variable over asking ncurses itself.

This is typically not a problem because we ask `TIOCGWINSZ` in Git, to
determine the correct value for `COLUMNS`, and then set that environment
variable.

However, on Windows it _is_ a problem. The reason is that Git for
Windows uses a version of `less` that relies on the MSYS2 runtime to
interact with the pseudo terminal (typically inside a MinTTY window,
which is also aware of the MSYS2 runtime). Both MinTTY and `less.exe`
interact with that pseudo terminal via `ioctl()` calls (which the MSYS2
runtime emulates even if there is no such thing on Windows).

But `git.exe` itself is _not_ aware of the MSYS2 runtime, or for that
matter of that pseudo terminal, and has no way to call `ioctl()` or
`TIOCGWINSZ`.

Therefore, `git.exe` will fall back to hard-coding 80 columns, no matter
what the actual terminal size is.

But `less.exe` is totally able to interact with the MSYS2 runtime and
would not actually require Git's help (which actually makes things
worse here). So let's not override `COLUMNS` on Windows.

Note: we do this _only_ on Windows, and _only_ if `TIOCGWINSZ` is not
defined, to reduce any potential undesired fall-out from this patch.

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
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 agomerge-ort: add prefetching for content merges
Elijah Newren [Tue, 15 Jun 2021 22:41:46 +0000 (22:41 +0000)] 
merge-ort: add prefetching for content merges

Commit 7fbbcb21b1 ("diff: batch fetching of missing blobs", 2019-04-05)
introduced batching of fetching missing blobs, so that the diff
machinery would have one fetch subprocess grab N blobs instead of N
processes each grabbing 1.

However, the diff machinery is not the only thing in a merge that needs
to work on blobs.  The 3-way content merges need them as well.  Rather
than download all the blobs 1 at a time, prefetch all the blobs needed
for regular content merges.

This does not cover all possible paths in merge-ort that might need to
download blobs.  Others include:
  - The blob_unchanged() calls to avoid modify/delete conflicts (when
    blob renormalization results in an "unchanged" file)
  - Preliminary content merges needed for rename/add and
    rename/rename(2to1) style conflicts.  (Both of these types of
    conflicts can result in nested conflict markers from the need to do
    two levels of content merging; the first happens before our new
    prefetch_for_content_merges() function.)

The first of these wouldn't be an extreme amount of work to support, and
even the second could be theoretically supported in batching, but all of
these cases seem unusual to me, and this is a minor performance
optimization anyway; in the worst case we only get some of the fetches
batched and have a few additional one-off fetches.  So for now, just
handle the regular 3-way content merges in our prefetching.

For the testcase from the previous commit, the number of downloaded
objects remains at 63, but this drops the number of fetches needed from
32 down to 20, a sizeable reduction.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agodiffcore-rename: use a different prefetch for basename comparisons
Elijah Newren [Tue, 15 Jun 2021 22:41:45 +0000 (22:41 +0000)] 
diffcore-rename: use a different prefetch for basename comparisons

merge-ort was designed to minimize the amount of data needed and used,
and several changes were made to diffcore-rename to take advantage of
extra metadata to enable this data minimization (particularly the
relevant_sources variable for skipping "irrelevant" renames).  This
effort obviously succeeded in drastically reducing computation times,
but should also theoretically allow partial clones to download much less
information.  Previously, though, the "prefetch" command used in
diffcore-rename had never been modified and downloaded many blobs that
were unnecessary for merge-ort.  This commit corrects that.

When doing basename comparisons, we want to fetch only the objects that
will be used for basename comparisons.  If after basename fetching this
leaves us with no more relevant sources (or no more destinations), then
we won't need to do the full inexact rename detection and can skip
downloading additional source and destination files.  Even if we have to
do that later full inexact rename detection, irrelevant sources are
culled after basename matching and before the full inexact rename
detection, so we can still avoid downloading the blobs for irrelevant
sources.  Rename prefetch() to inexact_prefetch(), and introduce a
new basename_prefetch() to take advantage of this.

If we modify the testcase from commit 557ac0350d ("merge-ort: begin
performance work; instrument with trace2_region_* calls", 2021-01-23)
to pass
    --sparse --filter=blob:none
to the clone command, and use the new trace2 "fetch_count" output from
a few commits ago to track both the number of fetch subcommands invoked
and the number of objects fetched across all those fetches, then for
the mega-renames testcase we observe the following:

BEFORE this commit, rebasing 35 patches:
    strategy     # of fetches    total # of objects fetched
    ---------    ------------    --------------------------
    recursive    62              11423
    ort          30              11391

AFTER this commit, rebasing the same 35 patches:
    ort          32                 63

This means that the new code only needs to download less than 2 blobs
per patch being rebased.  That is especially interesting given that the
repository at the start only had approximately half a dozen TOTAL blobs
downloaded to start with (because the default sparse-checkout of just
the toplevel directory was in use).

So, for this particular linux kernel testcase that involved ~26,000
renames on the upstream side (drivers/ -> pilots/) across which 35
patches were being rebased, this change reduces the number of blobs that
need to be downloaded by a factor of ~180.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agodiffcore-rename: allow different missing_object_cb functions
Elijah Newren [Tue, 15 Jun 2021 22:41:44 +0000 (22:41 +0000)] 
diffcore-rename: allow different missing_object_cb functions

estimate_similarity() was setting up a diff_populate_filespec_options
every time it was called, requiring the caller of estimate_similarity()
to pass in some data needed to set up this option.  Currently the needed
data consisted of a single variable (skip_unmodified), but we want to
also have the different estimate_similarity() callsites start using
different missing_object_cb functions as well.  Rather than also passing
that data in, just have the caller pass in the whole
diff_populate_filespec_options, and reduce the number of times we need to
set it up.

As a side note, this also drops the number of calls to
has_promisor_remote() dramatically.  If L is the number of basename
paths to compare, M is the number of inexact sources, and N is the
number of inexact destinations, then the number of calls to
has_promisor_remote() drops from L+M*N down to at most 2 -- one for each
of the sites that calls estimate_similarity().  has_promisor_remote() is
a very fast function so this almost certainly has no measurable
performance impact, but it seems cleaner to avoid calling that function
so many times.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot6421: add tests checking for excessive object downloads during merge
Elijah Newren [Tue, 15 Jun 2021 22:41:43 +0000 (22:41 +0000)] 
t6421: add tests checking for excessive object downloads during merge

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agopromisor-remote: output trace2 statistics for number of objects fetched
Elijah Newren [Tue, 15 Jun 2021 22:41:42 +0000 (22:41 +0000)] 
promisor-remote: output trace2 statistics for number of objects fetched

Signed-off-by: Elijah Newren <newren@gmail.com>
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 agoSQUASH???
Junio C Hamano [Wed, 16 Jun 2021 04:43:34 +0000 (13:43 +0900)] 
SQUASH???

4 years agosubmodule: cache superproject gitdir during 'update'
Emily Shaffer [Wed, 16 Jun 2021 00:45:08 +0000 (17:45 -0700)] 
submodule: cache superproject gitdir during 'update'

A cached path to the superproject's gitdir might be added during 'git
submodule add', but in some cases - like submodules which were created
before 'git submodule add' learned to cache that info - it might be
useful to update the cache. Let's do it during 'git submodule update',
when we already have a handle to the superproject while calling
operations on the submodules.

Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agosubmodule: cache superproject gitdir during absorbgitdirs
Emily Shaffer [Wed, 16 Jun 2021 00:45:07 +0000 (17:45 -0700)] 
submodule: cache superproject gitdir during absorbgitdirs

Already during 'git submodule add' we cache a pointer to the
superproject's gitdir. However, this doesn't help brand-new
submodules created with 'git init' and later absorbed with 'git
submodule absorbgitdir'. Let's start adding that pointer during 'git
submodule absorbgitdir' too.

Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agointroduce submodule.superprojectGitDir cache
Emily Shaffer [Wed, 16 Jun 2021 00:45:06 +0000 (17:45 -0700)] 
introduce submodule.superprojectGitDir cache

Teach submodules a reference to their superproject's gitdir. This allows
us to A) know that we're running from a submodule, and B) have a
shortcut to the superproject's vitals, for example, configs.

By using a relative path instead of an absolute path, we can move the
superproject directory around on the filesystem without breaking the
submodule's cache.

Since this cached value is only introduced during new submodule creation
via `git submodule add`, though, there is more work to do to allow the
cache to be created at other times.

Signed-off-by: Emily Shaffer <emilyshaffer@google.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 agopack-protocol doc: use "www-data" in place of "alice"
Ævar Arnfjörð Bjarmason [Tue, 15 Jun 2021 16:18:03 +0000 (18:18 +0200)] 
pack-protocol doc: use "www-data" in place of "alice"

Replace the example of "alice" in the pack-protocol.txt documentation
added in b31222cfb7f (Update packfile transfer protocol documentation,
2009-11-03) with "www-data". This is now consistent with the recently
changed examples in the tutorial and git-daemon documentation.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agodoc: replace "alice" and "bob" with "jdoe" and "msmith"
Ævar Arnfjörð Bjarmason [Tue, 15 Jun 2021 16:18:02 +0000 (18:18 +0200)] 
doc: replace "alice" and "bob" with "jdoe" and "msmith"

Change the "Alice" and "Bob" generic example users to jdoe@example.com
and msmith@example.com.

The former is widely used in RFC 5322 as an example E-Mail address,
the latter is not, but "Mary Smith <mary@example.com>". It has been
claimed that any reference to people's gender in our documentation is
distracting to some readers[1]. In this case it's easy enough to tweak
the example in such a way that the reader can insert their own
stand-in for "M.".

1. https://lore.kernel.org/git/pull.975.v3.git.1623766273.gitgitgadget@gmail.com/

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agofast-import doc: change "bob" in an example to "file.txt"
Ævar Arnfjörð Bjarmason [Tue, 15 Jun 2021 16:18:01 +0000 (18:18 +0200)] 
fast-import doc: change "bob" in an example to "file.txt"

The example added in e7e5170f804 (Update fast-import documentation to
discuss crash reports, 2008-02-14) is a bit confusing in that we're
referring to a "bob" when we really just need a placeholder name for a
file that has bad mode bits, let's use "file.txt" instead.

Let's also use "<<-" in the here-doc so this'll work if the reader
copies this from e.g. a tab-indented manual page, none of the content
needs leading whitespace, so that won't break anything if the content
isn't indented.

The fast-import error message and other output has also changed
slightly since 2008, let's update the relevant parts of it, while
retaining the original PID, time etc. of the 2007-era example.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agodaemon doc + code comments: reword "alice" example
Ævar Arnfjörð Bjarmason [Tue, 15 Jun 2021 16:18:00 +0000 (18:18 +0200)] 
daemon doc + code comments: reword "alice" example

Improve on the "alice" example added in 603968d22b1 (daemon: extend
user-relative path notation., 2006-02-04). I found the previous
version of this documentation a bit confusing, and had to read the
code to see what it was doing.

I think explicitly spelling out that the --user-path option can be
user to provide an infix to stash in-between what we'll resolve
"~user" and the path after that is clearer, especially when coupled
with explicit examples of path resolution.

Finally, the previous documentation didn't mention that `path/foo`
could actually resolve to `path/foo.git`. That's implicitly covered
earlier in the documentation, let's make an explicit reference to that
here.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>