]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
2 years agoMerge branch 'tl/ls-tree-oid-only'
Junio C Hamano [Fri, 8 Apr 2022 20:53:48 +0000 (13:53 -0700)] 
Merge branch 'tl/ls-tree-oid-only'

Docfix.

* tl/ls-tree-oid-only:
  ls-tree doc: document interaction with submodules

2 years agols-tree doc: document interaction with submodules
Ævar Arnfjörð Bjarmason [Fri, 8 Apr 2022 16:00:25 +0000 (18:00 +0200)] 
ls-tree doc: document interaction with submodules

The ls-tree documentation had never been updated after it learned to
interact with submodules to explicitly mention them. The initial
support was added in f35a6d3bce7 (Teach core object handling functions
about gitlinks, 2007-04-09). E.g. the discussion of --long added in
f35a6d3bce7 (Teach core object handling functions about gitlinks,
2007-04-09) didn't explicitly mention them.

But this documentation added in 455923e0a15 (ls-tree: introduce
"--format" option, 2022-03-23) had no such excuse, and was actively
misleading by providing an exhaustive but incomplete list of object
types we'd emit.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'jc/cat-file-batch-commands'
Junio C Hamano [Thu, 7 Apr 2022 22:04:19 +0000 (15:04 -0700)] 
Merge branch 'jc/cat-file-batch-commands'

Doc fix.

* jc/cat-file-batch-commands:
  Documentation: add --batch-command to cat-file synopsis

2 years agoDocumentation: add --batch-command to cat-file synopsis
Ævar Arnfjörð Bjarmason [Thu, 7 Apr 2022 19:08:59 +0000 (21:08 +0200)] 
Documentation: add --batch-command to cat-file synopsis

440c705ea63 (cat-file: add --batch-command mode, 2022-02-18) added
the new option and operating mode without listing it to the synopsis
section.  Fix it.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'tz/doc-litdd-fixes'
Junio C Hamano [Thu, 7 Apr 2022 19:23:47 +0000 (12:23 -0700)] 
Merge branch 'tz/doc-litdd-fixes'

Documentation markup fix.

* tz/doc-litdd-fixes:
  doc: replace "--" with {litdd} in credential-cache/fsmonitor

2 years agoMerge branch 'js/apply-partial-clone-filters-recursively'
Junio C Hamano [Thu, 7 Apr 2022 19:23:31 +0000 (12:23 -0700)] 
Merge branch 'js/apply-partial-clone-filters-recursively'

Typofix

* js/apply-partial-clone-filters-recursively:
  submodule-helper: fix usage string

2 years agoMerge branch 'tl/ls-tree-oid-only'
Junio C Hamano [Thu, 7 Apr 2022 19:23:23 +0000 (12:23 -0700)] 
Merge branch 'tl/ls-tree-oid-only'

* tl/ls-tree-oid-only:
  git-ls-tree.txt: fix the name of "%(objectsize:padded)"

2 years agogit-ls-tree.txt: fix the name of "%(objectsize:padded)"
Martin Ågren [Thu, 7 Apr 2022 15:52:31 +0000 (17:52 +0200)] 
git-ls-tree.txt: fix the name of "%(objectsize:padded)"

Commit 455923e0a1 ("ls-tree: introduce "--format" option", 2022-03-23)
introduced `--format` and the various placeholders it can take, such as
%(objectname) and %(objectsize).

At some point when that patch was being developed, those placeholders
had shorter names, e.g., %(name) and %(size), which can be seen in the
commit message of 455923e0a1. One instance of "%(size:padded)" also
managed to enter the documentation in the final version of the patch.
Correct it to "%(objectsize:padded)".

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agosubmodule-helper: fix usage string
Fangyi Zhou [Wed, 6 Apr 2022 20:32:57 +0000 (21:32 +0100)] 
submodule-helper: fix usage string

The missing space at the end of the line makes the closing square
bracket sticking to the dash in the next line

Found during localisation v2.36.0 round 1

Signed-off-by: Fangyi Zhou <me@fangyi.io>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodoc: replace "--" with {litdd} in credential-cache/fsmonitor
Todd Zullinger [Wed, 6 Apr 2022 18:41:22 +0000 (14:41 -0400)] 
doc: replace "--" with {litdd} in credential-cache/fsmonitor

Asciidoc renders `--` as em-dash.  This is not appropriate for command
names.  It also breaks linkgit links to these commands.

Fix git-credential-cache--daemon and git-fsmonitor--daemon.  The latter
was added 3248486920 (fsmonitor: document builtin fsmonitor, 2022-03-25)
and included several links.  A check for broken links in the HTML docs
turned this up.

Manually inspecting the other Documentation/git-*--*.txt files turned up
the issue in git-credential-cache--daemon.

While here, quote `git credential-cache--daemon` in the synopsis to
match the vast majority of our other documentation.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'tl/ls-tree-oid-only'
Junio C Hamano [Wed, 6 Apr 2022 22:21:59 +0000 (15:21 -0700)] 
Merge branch 'tl/ls-tree-oid-only'

"git ls-tree" learns "--oid-only" option, similar to "--name-only",
and more generalized "--format" option.
source: <cover.1648026472.git.dyroneteng@gmail.com>

* tl/ls-tree-oid-only:
  ls-tree: `-l` should not imply recursive listing

2 years agoMerge branch 'bc/csprng-mktemps'
Junio C Hamano [Wed, 6 Apr 2022 22:21:58 +0000 (15:21 -0700)] 
Merge branch 'bc/csprng-mktemps'

Build fix.

* bc/csprng-mktemps:
  git-compat-util: really support openssl as a source of entropy

2 years agoMerge branch 'ns/core-fsyncmethod'
Junio C Hamano [Wed, 6 Apr 2022 22:21:58 +0000 (15:21 -0700)] 
Merge branch 'ns/core-fsyncmethod'

A couple of fix-up to a topic that is now in 'master'.
source: <pull.1193.git.1648663716891.gitgitgadget@gmail.com>

* ns/core-fsyncmethod:
  configure.ac: fix HAVE_SYNC_FILE_RANGE definition

2 years agoMerge branch 'ab/make-optim-noop'
Junio C Hamano [Wed, 6 Apr 2022 22:21:58 +0000 (15:21 -0700)] 
Merge branch 'ab/make-optim-noop'

A micro fix to a topic earlier merged to 'master'
source: <patch-1.1-05949221e3f-20220319T002715Z-avarab@gmail.com>

* ab/make-optim-noop:
  contrib/scalar: fix 'all' target in Makefile
  Documentation/Makefile: fix "make info" regression in dad9cd7d518

2 years agocontrib/scalar: fix 'all' target in Makefile
Victoria Dye [Tue, 5 Apr 2022 22:35:36 +0000 (22:35 +0000)] 
contrib/scalar: fix 'all' target in Makefile

Add extra ':' to second 'all' target definition to allow 'scalar' to build.
Without this fix, the 'all:' and 'all::' targets together cause a build
failure when 'scalar' build is enabled with 'INCLUDE_SCALAR':

    Makefile:14: *** target file `all' has both : and :: entries.  Stop.

Signed-off-by: Victoria Dye <vdye@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoDocumentation/Makefile: fix "make info" regression in dad9cd7d518
Ævar Arnfjörð Bjarmason [Tue, 5 Apr 2022 19:56:20 +0000 (21:56 +0200)] 
Documentation/Makefile: fix "make info" regression in dad9cd7d518

Fix a regression in my dad9cd7d518 (Makefile: move ".SUFFIXES" rule to
shared.mak, 2022-03-03). As explained in the GNU make documentation
for the $* variable, available at:

info make --index-search='$*'

This rule relied on ".texi" being in the default list of suffixes, as
seen at:

make -f/dev/null -p | grep -v -e ^# -e ^$|grep -F .SUFFIXES

The documentation explains what was going on here:

In an explicit rule, there is no stem; so '$*' cannot be determined
in that way.  Instead, if the target name ends with a recognized
suffix (*note Old-Fashioned Suffix Rules: Suffix Rules.), '$*' is
set to the target name minus the suffix.  For example, if the
target name is 'foo.c', then '$*' is set to 'foo', since '.c' is a
suffix.  GNU 'make' does this bizarre thing only for compatibility
with other implementations of 'make'.  You should generally avoid
using '$*' except in implicit rules or static pattern rules.

If the target name in an explicit rule does not end with a
recognized suffix, '$*' is set to the empty string for that rule.

I.e. this rule added back in 5cefc33bffd (Documentation: add
gitman.info target, 2007-12-10) was resolving gitman.texi from
gitman.info. We can instead just use the more obvious $< variable
referring to the prerequisite.

This was the only use of $* in our Makefiles in an explicit rule, the
three remaining ones are all implicit rules, and therefore didn't
depend on the ".SUFFIXES" list.

Reported-by: Adam Dinwoodie <adam@dinwoodie.org>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Tested-by: Adam Dinwoodie <adam@dinwoodie.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoconfigure.ac: fix HAVE_SYNC_FILE_RANGE definition
Adam Dinwoodie [Tue, 5 Apr 2022 10:00:20 +0000 (11:00 +0100)] 
configure.ac: fix HAVE_SYNC_FILE_RANGE definition

If sync_file_range is not available when building the configure script,
there is a cosmetic bug when running that script reporting
"HAVE_SYNC_FILE_RANGE: command not found".  Remove that error message by
defining HAVE_SYNC_FILE_RANGE to an empty string, rather than generating
a script where that appears as a bare command.

Signed-off-by: Adam Dinwoodie <adam@dinwoodie.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agogit-compat-util: really support openssl as a source of entropy
Carlo Marcelo Arenas Belón [Tue, 5 Apr 2022 04:28:26 +0000 (21:28 -0700)] 
git-compat-util: really support openssl as a source of entropy

05cd988dce5 (wrapper: add a helper to generate numbers from a CSPRNG,
2022-01-17), configure openssl as the source for entropy in NON-STOP
but doesn't add the needed header or link options.

Since the only system that is configured to use openssl as a source
of entropy is NON-STOP, add the header unconditionally, and -lcrypto
to the list of external libraries.

An additional change is required to make sure a NO_OPENSSL=1 build
will be able to work as well (tested on Linux with a modified value
of CSPRNG_METHOD = openssl), and the more complex logic that allows
for compatibility with APPLE_COMMON_CRYPTO or allowing for simpler
ways to link (without libssl) has been punted for now.

Reported-by: Randall Becker <rsbecker@nexbridge.com>
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agols-tree: `-l` should not imply recursive listing
Josh Steadmon [Mon, 4 Apr 2022 22:42:24 +0000 (15:42 -0700)] 
ls-tree: `-l` should not imply recursive listing

In 9c4d58ff2c (ls-tree: split up "fast path" callbacks, 2022-03-23), a
refactoring of the various read_tree_at() callbacks caused us to
unconditionally recurse into directories if `-l` (long format) was
passed on the command line, regardless of whether or not we also pass
the `-r` (recursive) flag.

Fix this by making show_tree_long() return the value of `recurse`,
rather than always returning 1. This value is interpreted by
read_tree_at() to be a signal on whether or not to recurse.

Signed-off-by: Josh Steadmon <steadmon@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoGit 2.36-rc0 v2.36.0-rc0
Junio C Hamano [Mon, 4 Apr 2022 17:24:07 +0000 (10:24 -0700)] 
Git 2.36-rc0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'pw/worktree-list-with-z'
Junio C Hamano [Mon, 4 Apr 2022 17:56:25 +0000 (10:56 -0700)] 
Merge branch 'pw/worktree-list-with-z'

"git worktree list --porcelain" did not c-quote pathnames and lock
reasons with unsafe bytes correctly, which is worked around by
introducing NUL terminated output format with "-z".

* pw/worktree-list-with-z:
  worktree: add -z option for list subcommand

2 years agoMerge branch 'jc/coding-guidelines-decl-in-for-loop'
Junio C Hamano [Mon, 4 Apr 2022 17:56:24 +0000 (10:56 -0700)] 
Merge branch 'jc/coding-guidelines-decl-in-for-loop'

Coding Guidelines clarification.

* jc/coding-guidelines-decl-in-for-loop:
  CodingGuidelines: give deadline for "for (int i = 0; ..."

2 years agoMerge branch 'vd/mv-refresh-stat'
Junio C Hamano [Mon, 4 Apr 2022 17:56:24 +0000 (10:56 -0700)] 
Merge branch 'vd/mv-refresh-stat'

"git mv" failed to refresh the cached stat information for the
entry it moved.

* vd/mv-refresh-stat:
  mv: refresh stat info for moved entry

2 years agoMerge branch 'jh/builtin-fsmonitor-part2'
Junio C Hamano [Mon, 4 Apr 2022 17:56:24 +0000 (10:56 -0700)] 
Merge branch 'jh/builtin-fsmonitor-part2'

Built-in fsmonitor (part 2).

* jh/builtin-fsmonitor-part2: (30 commits)
  t7527: test status with untracked-cache and fsmonitor--daemon
  fsmonitor: force update index after large responses
  fsmonitor--daemon: use a cookie file to sync with file system
  fsmonitor--daemon: periodically truncate list of modified files
  t/perf/p7519: add fsmonitor--daemon test cases
  t/perf/p7519: speed up test on Windows
  t/perf/p7519: fix coding style
  t/helper/test-chmtime: skip directories on Windows
  t/perf: avoid copying builtin fsmonitor files into test repo
  t7527: create test for fsmonitor--daemon
  t/helper/fsmonitor-client: create IPC client to talk to FSMonitor Daemon
  help: include fsmonitor--daemon feature flag in version info
  fsmonitor--daemon: implement handle_client callback
  compat/fsmonitor/fsm-listen-darwin: implement FSEvent listener on MacOS
  compat/fsmonitor/fsm-listen-darwin: add MacOS header files for FSEvent
  compat/fsmonitor/fsm-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 'start' command
  ...

2 years agoMerge branch 'tk/ambiguous-fetch-refspec'
Junio C Hamano [Mon, 4 Apr 2022 17:56:23 +0000 (10:56 -0700)] 
Merge branch 'tk/ambiguous-fetch-refspec'

Give hint when branch tracking cannot be established because fetch
refspecs from multiple remote repositories overlap.

* tk/ambiguous-fetch-refspec:
  tracking branches: add advice to ambiguous refspec error

2 years agoMerge branch 'rc/fetch-refetch'
Junio C Hamano [Mon, 4 Apr 2022 17:56:23 +0000 (10:56 -0700)] 
Merge branch 'rc/fetch-refetch'

"git fetch --refetch" learned to fetch everything without telling
the other side what we already have, which is useful when you
cannot trust what you have in the local object store.

* rc/fetch-refetch:
  docs: mention --refetch fetch option
  fetch: after refetch, encourage auto gc repacking
  t5615-partial-clone: add test for fetch --refetch
  fetch: add --refetch option
  builtin/fetch-pack: add --refetch option
  fetch-pack: add refetch
  fetch-negotiator: add specific noop initializer

2 years agoMerge branch 'jc/mailsplit-warn-on-tty'
Junio C Hamano [Mon, 4 Apr 2022 17:56:23 +0000 (10:56 -0700)] 
Merge branch 'jc/mailsplit-warn-on-tty'

"git am" can read from the standard input when no mailbox is given
on the command line, but the end-user gets no indication when it
happens, making Git appear stuck.

* jc/mailsplit-warn-on-tty:
  am/apply: warn if we end up reading patches from terminal

2 years agoMerge branch 'ns/trace2-fsync-stat'
Junio C Hamano [Mon, 4 Apr 2022 17:56:23 +0000 (10:56 -0700)] 
Merge branch 'ns/trace2-fsync-stat'

Trace2 code has been taught to report stats for fsync operations.

* ns/trace2-fsync-stat:
  trace2: add stats for fsync operations

2 years agoMerge branch 'gc/branch-recurse-submodules-fix'
Junio C Hamano [Mon, 4 Apr 2022 17:56:22 +0000 (10:56 -0700)] 
Merge branch 'gc/branch-recurse-submodules-fix'

A handful of obvious clean-ups around a topic that is already in
'master'.

* gc/branch-recurse-submodules-fix:
  branch.c: simplify advice-and-die sequence
  branch: rework comments for future developers
  branch: remove negative exit code
  branch --set-upstream-to: be consistent when advising
  branch: give submodule updating advice before exit
  branch: support more tracking modes when recursing

2 years agoMerge branch 'ns/fsync-or-die-message-fix'
Junio C Hamano [Mon, 4 Apr 2022 17:56:22 +0000 (10:56 -0700)] 
Merge branch 'ns/fsync-or-die-message-fix'

When creating a loose object file, we didn't report the exact
filename of the file we failed to fsync, even though the
information was readily available, which has been corrected.

* ns/fsync-or-die-message-fix:
  object-file: pass filename to fsync_or_die

2 years agoMerge branch 'ns/core-fsyncmethod'
Junio C Hamano [Mon, 4 Apr 2022 17:56:22 +0000 (10:56 -0700)] 
Merge branch 'ns/core-fsyncmethod'

A couple of fix-up to a topic that is now in 'master'.

* ns/core-fsyncmethod:
  core.fsyncmethod: correctly camel-case warning message
  core.fsync: fix incorrect expression for default configuration

2 years agoMerge branch 'dp/worktree-repair-in-usage'
Junio C Hamano [Mon, 4 Apr 2022 17:56:22 +0000 (10:56 -0700)] 
Merge branch 'dp/worktree-repair-in-usage'

Usage string fix.

* dp/worktree-repair-in-usage:
  worktree: include repair cmd in usage

2 years agoMerge branch 'ab/reftable-aix-xlc-12'
Junio C Hamano [Mon, 4 Apr 2022 17:56:22 +0000 (10:56 -0700)] 
Merge branch 'ab/reftable-aix-xlc-12'

Work around AIX C compiler that does not seem to grok
initialization of a union member of a struct.

* ab/reftable-aix-xlc-12:
  reftable: make assignments portable to AIX xlc v12.01

2 years agoMerge branch 'gc/submodule-update-part2'
Junio C Hamano [Mon, 4 Apr 2022 17:56:21 +0000 (10:56 -0700)] 
Merge branch 'gc/submodule-update-part2'

Move more "git submodule update" to C.

* gc/submodule-update-part2:
  submodule--helper: remove forward declaration
  submodule: move core cmd_update() logic to C
  submodule--helper: reduce logic in run_update_procedure()
  submodule--helper: teach update_data more options
  builtin/submodule--helper.c: rename option struct to "opt"
  submodule update: use die_message()
  submodule--helper: run update using child process struct

2 years agoMerge branch 'ds/t7700-kept-pack-test'
Junio C Hamano [Mon, 4 Apr 2022 17:56:21 +0000 (10:56 -0700)] 
Merge branch 'ds/t7700-kept-pack-test'

Test clean-up.

* ds/t7700-kept-pack-test:
  test-lib-functions: remove test_subcommand_inexact
  t7700: check post-condition in kept-pack test

2 years agoMerge branch 'ds/partial-bundle-more'
Junio C Hamano [Mon, 4 Apr 2022 17:56:21 +0000 (10:56 -0700)] 
Merge branch 'ds/partial-bundle-more'

Code clean-up.

* ds/partial-bundle-more:
  pack-objects: lazily set up "struct rev_info", don't leak
  bundle: output hash information in 'verify'
  bundle: move capabilities to end of 'verify'
  pack-objects: parse --filter directly into revs.filter
  pack-objects: move revs out of get_object_list()
  list-objects-filter: remove CL_ARG__FILTER

2 years agoMerge branch 'tl/ls-tree-oid-only'
Junio C Hamano [Mon, 4 Apr 2022 17:56:21 +0000 (10:56 -0700)] 
Merge branch 'tl/ls-tree-oid-only'

"git ls-tree" learns "--oid-only" option, similar to "--name-only",
and more generalized "--format" option.

* tl/ls-tree-oid-only:
  ls-tree: split up "fast path" callbacks
  ls-tree: detect and error on --name-only --name-status
  ls-tree: support --object-only option for "git-ls-tree"
  ls-tree: introduce "--format" option
  cocci: allow padding with `strbuf_addf()`
  ls-tree: introduce struct "show_tree_data"
  ls-tree: slightly refactor `show_tree()`
  ls-tree: fix "--name-only" and "--long" combined use bug
  ls-tree: simplify nesting if/else logic in "show_tree()"
  ls-tree: rename "retval" to "recurse" in "show_tree()"
  ls-tree: use "size_t", not "int" for "struct strbuf"'s "len"
  ls-tree: use "enum object_type", not {blob,tree,commit}_type
  ls-tree: add missing braces to "else" arms
  ls-tree: remove commented-out code
  ls-tree tests: add tests for --name-status

2 years agoMerge branch 'ab/reflog-parse-options'
Junio C Hamano [Mon, 4 Apr 2022 17:56:21 +0000 (10:56 -0700)] 
Merge branch 'ab/reflog-parse-options'

"git reflog" command now uses parse-options API to parse its
command line options.

* ab/reflog-parse-options:
  reflog: fix 'show' subcommand's argv
  reflog [show]: display sensible -h output
  reflog: convert to parse_options() API
  reflog exists: use parse_options() API
  git reflog [expire|delete]: make -h output consistent with SYNOPSIS
  reflog: move "usage" variables and use macros
  reflog tests: add missing "git reflog exists" tests
  reflog: refactor cmd_reflog() to "if" branches
  reflog.c: indent argument lists

2 years agotracking branches: add advice to ambiguous refspec error
Tao Klerks [Fri, 1 Apr 2022 06:05:13 +0000 (06:05 +0000)] 
tracking branches: add advice to ambiguous refspec error

The error "not tracking: ambiguous information for ref" is raised
when we are evaluating what tracking information to set on a branch,
and find that the ref to be added as tracking branch is mapped
under multiple remotes' fetch refspecs.

This can easily happen when a user copy-pastes a remote definition
in their git config, and forgets to change the tracking path.

Add advice in this situation, explicitly highlighting which remotes
are involved and suggesting how to correct the situation. Also
update a test to explicitly expect that advice.

Signed-off-by: Tao Klerks <tao@klerks.biz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agobranch.c: simplify advice-and-die sequence
Glen Choo [Thu, 31 Mar 2022 22:41:18 +0000 (15:41 -0700)] 
branch.c: simplify advice-and-die sequence

In the dwim_branch_start(), when we cannot find an appropriate
upstream, we will die with the same message anyway, whether we
issue an advice message.

Flip the code around a bit and simplify the flow using
advise_if_enabled() function.

Helped-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Glen Choo <chooglen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agobranch: rework comments for future developers
Glen Choo [Thu, 31 Mar 2022 22:41:17 +0000 (15:41 -0700)] 
branch: rework comments for future developers

For two cases in which we do not explicitly pass --track=<choice>
option down to the submodule--helper subprocess, we have comments
that say "we do not have to pass --track", but in fact we not just
do not have to, but it would be incorrect to pass any --track option
to the subprocess (instead, the correct behaviour is to let the
subprocess figure out what is the appropriate tracking mode to use).

Signed-off-by: Glen Choo <chooglen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'ab/usage-die-message' into gc/branch-recurse-submodules-fix
Junio C Hamano [Thu, 31 Mar 2022 22:32:48 +0000 (15:32 -0700)] 
Merge branch 'ab/usage-die-message' into gc/branch-recurse-submodules-fix

* ab/usage-die-message:
  config API: use get_error_routine(), not vreportf()
  usage.c + gc: add and use a die_message_errno()
  gc: return from cmd_gc(), don't call exit()
  usage.c API users: use die_message() for error() + exit 128
  usage.c API users: use die_message() for "fatal :" + exit 128
  usage.c: add a die_message() routine

2 years agoworktree: add -z option for list subcommand
Phillip Wood [Thu, 31 Mar 2022 16:21:28 +0000 (16:21 +0000)] 
worktree: add -z option for list subcommand

Add a -z option to be used in conjunction with --porcelain that gives
NUL-terminated output. As 'worktree list --porcelain' does not quote
worktree paths this enables it to handle worktree paths that contain
newlines.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoCodingGuidelines: give deadline for "for (int i = 0; ..."
Junio C Hamano [Thu, 31 Mar 2022 00:09:16 +0000 (17:09 -0700)] 
CodingGuidelines: give deadline for "for (int i = 0; ..."

We raised the weather balloon to see if we can allow the construct
in 44ba10d6 (revision: use C99 declaration of variable in for()
loop, 2021-11-14), which was shipped as a part of Git v2.35.
Document that fact in the coding guidelines, and more importantly,
give ourselves a deadline to revisit and update.

Let's declare that we will officially adopt the variable declaration
in the initializaiton part of "for ()" statement this winter, unless
we find that a platform we care about does not grok it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoThe 17th batch
Junio C Hamano [Thu, 31 Mar 2022 00:43:19 +0000 (17:43 -0700)] 
The 17th batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'ab/test-tap-fix-for-immediate'
Junio C Hamano [Thu, 31 Mar 2022 01:01:11 +0000 (18:01 -0700)] 
Merge branch 'ab/test-tap-fix-for-immediate'

Fix test framework a bit.

* ab/test-tap-fix-for-immediate:
  test-lib: have --immediate emit valid TAP on failure

2 years agoMerge branch 'ab/hook-tests-updates'
Junio C Hamano [Thu, 31 Mar 2022 01:01:11 +0000 (18:01 -0700)] 
Merge branch 'ab/hook-tests-updates'

Update tests around the use of hook scripts.

* ab/hook-tests-updates:
  http tests: use "test_hook" for "smart" and "dumb" http tests
  proc-receive hook tests: use "test_hook" instead of "write_script"
  tests: extend "test_hook" for "rm" and "chmod -x", convert "$HOOK"
  tests: use "test_hook" for misc "mkdir -p" and "chmod" cases
  tests: change "mkdir -p && write_script" to use "test_hook"
  tests: change "cat && chmod +x" to use "test_hook"
  gc + p4 tests: use "test_hook", remove sub-shells
  fetch+push tests: use "test_hook" and "test_when_finished" pattern
  bugreport tests: tighten up "git bugreport -s hooks" test
  tests: assume the hooks are disabled by default
  http tests: don't rely on "hook/post-update.sample"
  hook tests: turn exit code assertions into a loop
  test-lib-functions: add and use a "test_hook" wrapper

2 years agoMerge branch 'jd/prompt-upstream-mark'
Junio C Hamano [Thu, 31 Mar 2022 01:01:11 +0000 (18:01 -0700)] 
Merge branch 'jd/prompt-upstream-mark'

Tweaks in the command line prompt (in contrib/) code around its
GIT_PS1_SHOWUPSTREAM feature.

* jd/prompt-upstream-mark:
  git-prompt: put upstream comments together
  git-prompt: make long upstream state indicator consistent
  git-prompt: make upstream state indicator location consistent
  git-prompt: rename `upstream` to `upstream_type`

2 years agoMerge branch 'pw/add-p-single-key'
Junio C Hamano [Thu, 31 Mar 2022 01:01:11 +0000 (18:01 -0700)] 
Merge branch 'pw/add-p-single-key'

Finishing touches to C rewrite of "git add -i" in single-key
interactive mode.

* pw/add-p-single-key:
  terminal: restore settings on SIGTSTP
  terminal: work around macos poll() bug
  terminal: don't assume stdin is /dev/tty
  terminal: use flags for save_term()

2 years agoMerge branch 'ab/make-optim-noop'
Junio C Hamano [Thu, 31 Mar 2022 01:01:11 +0000 (18:01 -0700)] 
Merge branch 'ab/make-optim-noop'

A micro fix to a topic earlier merged to 'master'

* ab/make-optim-noop:
  Makefile: use ' ', not non-existing $(wspfx_SQ)

2 years agoMerge branch 'vd/stash-silence-reset'
Junio C Hamano [Thu, 31 Mar 2022 01:01:10 +0000 (18:01 -0700)] 
Merge branch 'vd/stash-silence-reset'

"git stash" does not allow subcommands it internally runs as its
implementation detail, except for "git reset", to emit messages;
now "git reset" part has also been squelched.

* vd/stash-silence-reset:
  reset: show --no-refresh in the short-help
  reset: remove 'reset.refresh' config option
  reset: remove 'reset.quiet' config option
  reset: do not make '--quiet' disable index refresh
  stash: make internal resets quiet and refresh index
  reset: suppress '--no-refresh' advice if logging is silenced
  reset: replace '--quiet' with '--no-refresh' in performance advice
  reset: introduce --[no-]refresh option to --mixed
  reset: revise index refresh advice

2 years agoMerge branch 'ab/racy-hooks'
Junio C Hamano [Thu, 31 Mar 2022 01:01:10 +0000 (18:01 -0700)] 
Merge branch 'ab/racy-hooks'

Regression fix.

* ab/racy-hooks:
  hooks: fix "invoked hook" regression in a8cc5943338

2 years agobranch: remove negative exit code
Glen Choo [Tue, 29 Mar 2022 20:01:19 +0000 (20:01 +0000)] 
branch: remove negative exit code

Replace an instance of "exit(-1)" with "exit(1)". We don't use negative
exit codes - they are misleading because Unix machines will coerce them
to 8-bit unsigned values, losing the sign.

Signed-off-by: Glen Choo <chooglen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoobject-file: pass filename to fsync_or_die
Neeraj Singh [Wed, 30 Mar 2022 18:14:15 +0000 (18:14 +0000)] 
object-file: pass filename to fsync_or_die

If we die while trying to fsync a loose object file, pass the actual
filename we're trying to sync. This is likely to be more helpful for a
user trying to diagnose the cause of the failure than the former
'loose object file' string. It also sidesteps any concerns about
translating the die message differently for loose objects versus
something else that has a real path.

Reported-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Neeraj Singh <neerajsi@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocore.fsyncmethod: correctly camel-case warning message
Neeraj Singh [Wed, 30 Mar 2022 18:08:36 +0000 (18:08 +0000)] 
core.fsyncmethod: correctly camel-case warning message

The warning for an unrecognized fsyncMethod was not
camel-cased.

Reported-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Neeraj Singh <neerajsi@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agobranch --set-upstream-to: be consistent when advising
Glen Choo [Tue, 29 Mar 2022 20:01:18 +0000 (20:01 +0000)] 
branch --set-upstream-to: be consistent when advising

"git branch --set-upstream-to" behaves differently when advice is
enabled/disabled:

|                 | error prefix | exit code |
|-----------------+--------------+-----------|
| advice enabled  | error:       |         1 |
| advice disabled | fatal:       |       128 |

Make both cases consistent by using die_message() when advice is
enabled (this was first proposed in [1]).

[1] https://lore.kernel.org/git/211210.86ee6ldwlc.gmgdl@evledraar.gmail.com

Signed-off-by: Glen Choo <chooglen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agobranch: give submodule updating advice before exit
Glen Choo [Tue, 29 Mar 2022 20:01:17 +0000 (20:01 +0000)] 
branch: give submodule updating advice before exit

Fix a bug where "hint:" was printed _before_ "fatal:" (instead of the
other way around).

Signed-off-by: Glen Choo <chooglen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agobranch: support more tracking modes when recursing
Glen Choo [Tue, 29 Mar 2022 20:01:16 +0000 (20:01 +0000)] 
branch: support more tracking modes when recursing

"git branch --recurse-submodules" does not propagate "--track=inherit"
or "--no-track" to submodules, which causes submodule branches to use
the wrong tracking mode [1]. To fix this, pass the correct options to
the "submodule--helper create-branch" child process and test for it.

While we are refactoring the same code, replace "--track" with the
synonymous, but more consistent-looking "--track=direct" option
(introduced at the same time as "--track=inherit", d3115660b4 (branch:
add flags and config to inherit tracking, 2021-12-20)).

[1] This bug is partially a timing issue: "branch --recurse-submodules"
 was introduced around the same time as "--track=inherit", and even
 though I rebased "branch --recurse-submodules" on top of that, I had
 neglected to support the new tracking mode. Omitting "--no-track"
 was just a plain old mistake, though.

Signed-off-by: Glen Choo <chooglen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agotrace2: add stats for fsync operations
Neeraj Singh [Wed, 30 Mar 2022 05:06:40 +0000 (05:06 +0000)] 
trace2: add stats for fsync operations

Add some global trace2 statistics for the number of fsyncs performed
during the lifetime of a Git process.

These stats are printed as part of trace2_cmd_exit_fl, which is
presumably where we might want to print any other cross-cutting
statistics.

Signed-off-by: Neeraj Singh <neerajsi@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocore.fsync: fix incorrect expression for default configuration
Neeraj Singh [Tue, 29 Mar 2022 21:41:52 +0000 (21:41 +0000)] 
core.fsync: fix incorrect expression for default configuration

Commit b9f5d035 (core.fsync: documentation and user-friendly
aggregate options, 2022-03-15) introduced an incorrect value for
FSYNC_COMPONENTS_DEFAULT. We need an AND-NOT rather than OR-NOT.

Signed-off-by: Neeraj Singh <neerajsi@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoThe 16th batch
Junio C Hamano [Tue, 29 Mar 2022 19:14:56 +0000 (12:14 -0700)] 
The 16th batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'jc/rebase-detach-fix'
Junio C Hamano [Tue, 29 Mar 2022 19:22:03 +0000 (12:22 -0700)] 
Merge branch 'jc/rebase-detach-fix'

"git rebase $base $non_branch_commit", when $base is an ancestor or
the $non_branch_commit, modified the current branch, which has been
corrected.

* jc/rebase-detach-fix:
  rebase: set REF_HEAD_DETACH in checkout_up_to_date()
  rebase: use test_commit helper in setup

2 years agoMerge branch 'jt/reset-grafts-when-resetting-shallow'
Junio C Hamano [Tue, 29 Mar 2022 19:22:03 +0000 (12:22 -0700)] 
Merge branch 'jt/reset-grafts-when-resetting-shallow'

When "shallow" information is updated, we forgot to update the
in-core equivalent, which has been corrected.

* jt/reset-grafts-when-resetting-shallow:
  shallow: reset commit grafts when shallow is reset

2 years agoMerge branch 'vd/cache-bottom-fix'
Junio C Hamano [Tue, 29 Mar 2022 19:22:02 +0000 (12:22 -0700)] 
Merge branch 'vd/cache-bottom-fix'

Correct a bug in unpack-trees introduced earlier.

* vd/cache-bottom-fix:
  Revert "unpack-trees: improve performance of next_cache_entry"
  unpack-trees: increment cache_bottom for sparse directories
  t1092: add sparse directory before cone in test repo

2 years agoMerge branch 'ab/refs-various-fixes'
Junio C Hamano [Tue, 29 Mar 2022 19:22:02 +0000 (12:22 -0700)] 
Merge branch 'ab/refs-various-fixes'

Code clean-up.

* ab/refs-various-fixes:
  refs debug: add a wrapper for "read_symbolic_ref"
  packed-backend: remove stub BUG(...) functions
  misc *.c: use designated initializers for struct assignments
  refs: use designated initializers for "struct ref_iterator_vtable"
  refs: use designated initializers for "struct ref_storage_be"

2 years agoworktree: include repair cmd in usage
Des Preston [Mon, 28 Mar 2022 20:47:05 +0000 (20:47 +0000)] 
worktree: include repair cmd in usage

The worktree repair command was not added to the usage menu for the
worktree command. This commit adds the usage of 'worktree repair'
according to the existing docs.

Signed-off-by: Des Preston <despreston@gmail.com>
Acked-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agomv: refresh stat info for moved entry
Victoria Dye [Tue, 29 Mar 2022 01:07:07 +0000 (01:07 +0000)] 
mv: refresh stat info for moved entry

Update the stat info of the moved index entry in 'rename_index_entry_at()'
if the entry is up-to-date with the index. Internally, 'git mv' uses
'rename_index_entry_at()' to move the source index entry to the destination.
However, it directly copies the stat info of the original cache entry, which
will not reflect the 'ctime' of the file renaming operation that happened as
part of the move. If a file is otherwise up-to-date with the index, that
difference in 'ctime' will make the entry appear out-of-date until the next
index-refreshing operation (e.g., 'git status').

Some commands, such as 'git reset', use the cached stat information to
determine whether a file is up-to-date; if this information is incorrect,
the command will fail when it should pass. In order to ensure a moved entry
is evaluated as 'up-to-date' when appropriate, refresh the destination index
entry's stat info in 'git mv' if and only if the file is up-to-date.

Note that the test added in 't7001-mv.sh' requires a "sleep 1" to ensure the
'ctime' of the file creation will be definitively older than the 'ctime' of
the renamed file in 'git mv'.

Reported-by: Maximilian Reichel <reichemn@icloud.com>
Signed-off-by: Victoria Dye <vdye@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoreflog: fix 'show' subcommand's argv
SZEDER Gábor [Mon, 28 Mar 2022 21:21:52 +0000 (23:21 +0200)] 
reflog: fix 'show' subcommand's argv

cmd_reflog() invokes parse_options() with PARSE_OPT_KEEP_ARGV0, but it
doesn't account for the retained argv[0] before invoking
cmd_reflog_show() to handle the 'git reflog show' subcommand.
Consequently, cmd_reflog_show() always gets an 'argv' array starting
with elements argv[0]="reflog" and argv[1]="show".

Strip the name of the git command from the 'argv' array before passing
it to the function handling the 'show' subcommand.

There is no user-visible bug here, because cmd_reflog_show() doesn't
have any options or parameters of its own.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoreftable: make assignments portable to AIX xlc v12.01
Ævar Arnfjörð Bjarmason [Mon, 28 Mar 2022 19:10:04 +0000 (21:10 +0200)] 
reftable: make assignments portable to AIX xlc v12.01

Change the assignment syntax introduced in 66c0dabab5e (reftable: make
reftable_record a tagged union, 2022-01-20) to be portable to AIX xlc
v12.1:

    avar@gcc111:[/home/avar]xlc -qversion
    IBM XL C/C++ for AIX, V12.1 (5765-J02, 5725-C72)
    Version: 12.01.0000.0000

The error emitted before this was e.g.:

    "reftable/generic.c", line 133.26: 1506-196 (S) Initialization
    between types "char*" and "struct reftable_ref_record" is not
    allowed.

The syntax in the pre-image is supported by e.g. xlc 13.01 on a newer
AIX version:

    avar@gcc119:[/home/avar]xlc -qversion
    IBM XL C/C++ for AIX, V13.1.3 (5725-C72, 5765-J07)
    Version: 13.01.0003.0006

But as we've otherwise supported this compiler let's not break it
entirely if it's easy to work around it.

Suggested-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodocs: mention --refetch fetch option
Robert Coup [Mon, 28 Mar 2022 14:02:11 +0000 (14:02 +0000)] 
docs: mention --refetch fetch option

Document it for partial clones as a means to apply a new filter, and
reference it from the remote.<name>.partialclonefilter config parameter.

Signed-off-by: Robert Coup <robert@coup.net.nz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofetch: after refetch, encourage auto gc repacking
Robert Coup [Mon, 28 Mar 2022 14:02:10 +0000 (14:02 +0000)] 
fetch: after refetch, encourage auto gc repacking

After invoking `fetch --refetch`, the object db will likely contain many
duplicate objects. If auto-maintenance is enabled, invoke it with
appropriate settings to encourage repacking/consolidation.

* gc.autoPackLimit: unless this is set to 0 (disabled), override the
  value to 1 to force pack consolidation.
* maintenance.incremental-repack.auto: unless this is set to 0, override
  the value to -1 to force incremental repacking.

Signed-off-by: Robert Coup <robert@coup.net.nz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot5615-partial-clone: add test for fetch --refetch
Robert Coup [Mon, 28 Mar 2022 14:02:09 +0000 (14:02 +0000)] 
t5615-partial-clone: add test for fetch --refetch

Add a test for doing a refetch to apply a changed partial clone filter
under protocol v0 and v2.

Signed-off-by: Robert Coup <robert@coup.net.nz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofetch: add --refetch option
Robert Coup [Mon, 28 Mar 2022 14:02:08 +0000 (14:02 +0000)] 
fetch: add --refetch option

Teach fetch and transports the --refetch option to force a full fetch
without negotiating common commits with the remote. Use when applying a
new partial clone filter to refetch all matching objects.

Signed-off-by: Robert Coup <robert@coup.net.nz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agobuiltin/fetch-pack: add --refetch option
Robert Coup [Mon, 28 Mar 2022 14:02:07 +0000 (14:02 +0000)] 
builtin/fetch-pack: add --refetch option

Add a refetch option to fetch-pack to force a full fetch. Use when
applying a new partial clone filter to refetch all matching objects.

Signed-off-by: Robert Coup <robert@coup.net.nz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofetch-pack: add refetch
Robert Coup [Mon, 28 Mar 2022 14:02:06 +0000 (14:02 +0000)] 
fetch-pack: add refetch

Allow a "refetch" where the contents of the local object store are
ignored and a full fetch is performed, not attempting to find or
negotiate common commits with the remote.

A key use case is to apply a new partial clone blob/tree filter and
refetch all the associated matching content, which would otherwise not
be transferred when the commit objects are already present locally.

Signed-off-by: Robert Coup <robert@coup.net.nz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofetch-negotiator: add specific noop initializer
Robert Coup [Mon, 28 Mar 2022 14:02:05 +0000 (14:02 +0000)] 
fetch-negotiator: add specific noop initializer

Add a specific initializer for the noop fetch negotiator. This is
introduced to support allowing partial clones to skip commit negotiation
when performing a "refetch".

Signed-off-by: Robert Coup <robert@coup.net.nz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agopack-objects: lazily set up "struct rev_info", don't leak
Ævar Arnfjörð Bjarmason [Mon, 28 Mar 2022 15:43:18 +0000 (17:43 +0200)] 
pack-objects: lazily set up "struct rev_info", don't leak

In the preceding [1] (pack-objects: move revs out of
get_object_list(), 2022-03-22) the "repo_init_revisions()" was moved
to cmd_pack_objects() so that it unconditionally took place for all
invocations of "git pack-objects".

We'd thus start leaking memory, which is easily reproduced in
e.g. git.git by feeding e83c5163316 (Initial revision of "git", the
information manager from hell, 2005-04-07) to "git pack-objects";

    $ echo e83c5163316f89bfbde7d9ab23ca2e25604af290 | ./git pack-objects initial
    [...]
==19130==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 7120 byte(s) in 1 object(s) allocated from:
    #0 0x455308 in __interceptor_malloc (/home/avar/g/git/git+0x455308)
    #1 0x75b399 in do_xmalloc /home/avar/g/git/wrapper.c:41:8
    #2 0x75b356 in xmalloc /home/avar/g/git/wrapper.c:62:9
    #3 0x5d7609 in prep_parse_options /home/avar/g/git/diff.c:5647:2
    #4 0x5d415a in repo_diff_setup /home/avar/g/git/diff.c:4621:2
    #5 0x6dffbb in repo_init_revisions /home/avar/g/git/revision.c:1853:2
    #6 0x4f599d in cmd_pack_objects /home/avar/g/git/builtin/pack-objects.c:3980:2
    #7 0x4592ca in run_builtin /home/avar/g/git/git.c:465:11
    #8 0x457d81 in handle_builtin /home/avar/g/git/git.c:718:3
    #9 0x458ca5 in run_argv /home/avar/g/git/git.c:785:4
    #10 0x457b40 in cmd_main /home/avar/g/git/git.c:916:19
    #11 0x562259 in main /home/avar/g/git/common-main.c:56:11
    #12 0x7fce792ac7ec in __libc_start_main csu/../csu/libc-start.c:332:16
    #13 0x4300f9 in _start (/home/avar/g/git/git+0x4300f9)

SUMMARY: LeakSanitizer: 7120 byte(s) leaked in 1 allocation(s).
Aborted

Narrowly fixing that commit would have been easy, just add call
repo_init_revisions() right before get_object_list(), which is
effectively what was done before that commit.

But an unstated constraint when setting it up early is that it was
needed for the subsequent [2] (pack-objects: parse --filter directly
into revs.filter, 2022-03-22), i.e. we might have a --filter
command-line option, and need to either have the "struct rev_info"
setup when we encounter that option, or later.

Let's just change the control flow so that we'll instead set up the
"struct rev_info" only when we need it. Doing so leads to a bit more
verbosity, but it's a lot clearer what we're doing and why.

An earlier version of this commit[3] went behind
opt_parse_list_objects_filter()'s back by faking up a "struct option"
before calling it. Let's avoid that and instead create a blessed API
for this pattern.

We could furthermore combine the two get_object_list() invocations
here by having repo_init_revisions() invoked on &pfd.revs, but I think
clearly separating the two makes the flow clearer. Likewise
redundantly but explicitly (i.e. redundant v.s. a "{ 0 }") "0" to
"have_revs" early in cmd_pack_objects().

While we're at it add parentheses around the arguments to the OPT_*
macros in in list-objects-filter-options.h, as we need to change those
lines anyway. It doesn't matter in this case, but is good general
practice.

1. https://lore.kernel.org/git/619b757d98465dbc4995bdc11a5282fbfcbd3daa.1647970119.git.gitgitgadget@gmail.com
2. https://lore.kernel.org/git/97de926904988b89b5663bd4c59c011a1723a8f5.1647970119.git.gitgitgadget@gmail.com
3. https://lore.kernel.org/git/patch-1.1-193534b0f07-20220325T121715Z-avarab@gmail.com/

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoThe 15th batch
Junio C Hamano [Fri, 25 Mar 2022 23:35:36 +0000 (16:35 -0700)] 
The 15th batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'gc/recursive-fetch-with-unused-submodules'
Junio C Hamano [Fri, 25 Mar 2022 23:38:25 +0000 (16:38 -0700)] 
Merge branch 'gc/recursive-fetch-with-unused-submodules'

When "git fetch --recurse-submodules" grabbed submodule commits
that would be needed to recursively check out newly fetched commits
in the superproject, it only paid attention to submodules that are
in the current checkout of the superproject.  We now do so for all
submodules that have been run "git submodule init" on.

* gc/recursive-fetch-with-unused-submodules:
  submodule: fix latent check_has_commit() bug
  fetch: fetch unpopulated, changed submodules
  submodule: move logic into fetch_task_create()
  submodule: extract get_fetch_task()
  submodule: store new submodule commits oid_array in a struct
  submodule: inline submodule_commits() into caller
  submodule: make static functions read submodules from commits
  t5526: create superproject commits with test helper
  t5526: stop asserting on stderr literally
  t5526: introduce test helper to assert on fetches

2 years agoMerge branch 'ps/fsync-refs'
Junio C Hamano [Fri, 25 Mar 2022 23:38:24 +0000 (16:38 -0700)] 
Merge branch 'ps/fsync-refs'

Updates to refs traditionally weren't fsync'ed, but we can
configure using core.fsync variable to do so.

* ps/fsync-refs:
  core.fsync: new option to harden references

2 years agoMerge branch 'ns/core-fsyncmethod'
Junio C Hamano [Fri, 25 Mar 2022 23:38:24 +0000 (16:38 -0700)] 
Merge branch 'ns/core-fsyncmethod'

Replace core.fsyncObjectFiles with two new configuration variables,
core.fsync and core.fsyncMethod.

* ns/core-fsyncmethod:
  core.fsync: documentation and user-friendly aggregate options
  core.fsync: new option to harden the index
  core.fsync: add configuration parsing
  core.fsync: introduce granular fsync control infrastructure
  core.fsyncmethod: add writeout-only mode
  wrapper: make inclusion of Windows csprng header tightly scoped

2 years agot7527: test status with untracked-cache and fsmonitor--daemon
Jeff Hostetler [Fri, 25 Mar 2022 18:03:13 +0000 (18:03 +0000)] 
t7527: test status with untracked-cache and fsmonitor--daemon

Create 2x2 test matrix with the untracked-cache and fsmonitor--daemon
features and a series of edits and verify that status output is
identical.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsmonitor: force update index after large responses
Jeff Hostetler [Fri, 25 Mar 2022 18:03:12 +0000 (18:03 +0000)] 
fsmonitor: force update index after large responses

Measure the time taken to apply the FSMonitor query result
to the index and the untracked-cache.

Set the `FSMONITOR_CHANGED` bit on `istate->cache_changed` when
FSMonitor returns a very large repsonse to ensure that the index is
written to disk.

Normally, when the FSMonitor response includes a tracked file, the
index is always updated.  Similarly, the index might be updated when
the response alters the untracked-cache (when enabled).  However, in
cases where neither of those cause the index to be considered changed,
the FSMonitor response is wasted.  Subsequent Git commands will make
requests with the same token and receive the same response.

If that response is very large, performance may suffer.  It would be
more efficient to force update the index now (and the token in the
index extension) in order to reduce the size of the response received
by future commands.

This was observed on Windows after a large checkout.  On Windows, the
kernel emits events for the files that are changed as they are
changed.  However, it might delay events for the containing
directories until the system is more idle (or someone scans the
directory (so it seems)).  The first status following a checkout would
get the list of files.  The subsequent status commands would get the
list of directories as the events trickled out.  But they would never
catch up because the token was not advanced because the index wasn't
updated.

This list of directories caused `wt_status_collect_untracked()` to
unnecessarily spend time actually scanning them during each command.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsmonitor--daemon: use a cookie file to sync with file system
Jeff Hostetler [Fri, 25 Mar 2022 18:03:11 +0000 (18:03 +0000)] 
fsmonitor--daemon: use a cookie file to sync with file system

Teach fsmonitor--daemon client threads to create a cookie file
inside the .git directory and then wait until FS events for the
cookie are observed by the FS listener thread.

This helps address the racy nature of file system events by
blocking the client response until the kernel has drained any
event backlog.

This is especially important on MacOS where kernel events are
only issued with a limited frequency.  See the `latency` argument
of `FSeventStreamCreate()`.  The kernel only signals every `latency`
seconds, but does not guarantee that the kernel queue is completely
drained, so we may have to wait more than one interval.  If we
increase the latency, the system is more likely to drop events.
We avoid these issues by having each client thread create a unique
cookie file and then wait until it is seen in the event stream.

Co-authored-by: Kevin Willford <Kevin.Willford@microsoft.com>
Co-authored-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsmonitor--daemon: periodically truncate list of modified files
Jeff Hostetler [Fri, 25 Mar 2022 18:03:10 +0000 (18:03 +0000)] 
fsmonitor--daemon: periodically truncate list of modified files

Teach fsmonitor--daemon to periodically truncate the list of
modified files to save some memory.

Clients will ask for the set of changes relative to a token that they
found in the FSMN index extension in the index.  (This token is like a
point in time, but different).  Clients will then update the index to
contain the response token (so that subsequent commands will be
relative to this new token).

Therefore, the daemon can gradually truncate the in-memory list of
changed paths as they become obsolete (older than the previous token).
Since we may have multiple clients making concurrent requests with a
skew of tokens and clients may be racing to the talk to the daemon,
we lazily truncate the list.

We introduce a 5 minute delay and truncate batches 5 minutes after
they are considered obsolete.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot/perf/p7519: add fsmonitor--daemon test cases
Jeff Hostetler [Fri, 25 Mar 2022 18:03:09 +0000 (18:03 +0000)] 
t/perf/p7519: add fsmonitor--daemon test cases

Repeat all of the fsmonitor perf tests using `git fsmonitor--daemon` and
the "Simple IPC" interface.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot/perf/p7519: speed up test on Windows
Jeff Hostetler [Fri, 25 Mar 2022 18:03:08 +0000 (18:03 +0000)] 
t/perf/p7519: speed up test on Windows

Change p7519 to use `test_seq` and `xargs` rather than a `for` loop
to touch thousands of files.  This takes minutes off of test runs
on Windows because of process creation overhead.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot/perf/p7519: fix coding style
Jeff Hostetler [Fri, 25 Mar 2022 18:03:07 +0000 (18:03 +0000)] 
t/perf/p7519: fix coding style

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot/helper/test-chmtime: skip directories on Windows
Jeff Hostetler [Fri, 25 Mar 2022 18:03:06 +0000 (18:03 +0000)] 
t/helper/test-chmtime: skip directories on Windows

Teach `test-tool.exe chmtime` to ignore errors when setting the mtime
on a directory on Windows.

NEEDSWORK: The Windows version of `utime()` (aka `mingw_utime()`) does
not properly handle directories because it uses `_wopen()`.  It should
be converted to using `CreateFileW()` and backup semantics at a minimum.
Since I'm already in the middle of a large patch series, I did not want
to destabilize other callers of `utime()` right now.  The problem has
only been observed in the t/perf/p7519 test when the test repo contains
an empty directory on disk.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot/perf: avoid copying builtin fsmonitor files into test repo
Jeff Hostetler [Fri, 25 Mar 2022 18:03:05 +0000 (18:03 +0000)] 
t/perf: avoid copying builtin fsmonitor files into test repo

Do not copy any of the various fsmonitor--daemon files from the .git
directory of the (GIT_PREF_REPO or GIT_PERF_LARGE_REPO) source repo
into the test's trash directory.

When perf tests start, they copy the contents of the source repo into
the test's trash directory.  If fsmonitor is running in the source repo,
there may be control files, such as the IPC socket and/or fsmonitor
cookie files.  These should not be copied into the test repo.

Unix domain sockets cannot be copied in the manner used by the test
setup, so if present, the test setup fails.

Cookie files are harmless, but we should avoid them.

The builtin fsmonitor keeps all such control files/sockets in
.git/fsmonitor--daemon*, so it is simple to exclude them.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot7527: create test for fsmonitor--daemon
Jeff Hostetler [Fri, 25 Mar 2022 18:03:04 +0000 (18:03 +0000)] 
t7527: create test for fsmonitor--daemon

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot/helper/fsmonitor-client: create IPC client to talk to FSMonitor Daemon
Jeff Hostetler [Fri, 25 Mar 2022 18:03:03 +0000 (18:03 +0000)] 
t/helper/fsmonitor-client: create IPC client to talk to FSMonitor Daemon

Create an IPC client to send query and flush commands to the daemon.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agohelp: include fsmonitor--daemon feature flag in version info
Jeff Hostetler [Fri, 25 Mar 2022 18:03:02 +0000 (18:03 +0000)] 
help: include fsmonitor--daemon feature flag in version info

Add the "feature: fsmonitor--daemon" message to the output of
`git version --build-options`.

The builtin FSMonitor is only available on certain platforms and
even then only when certain Makefile flags are enabled, so print
a message in the verbose version output when it is available.

This can be used by test scripts for prereq testing.  Granted, tests
could just try `git fsmonitor--daemon status` and look for a 128 exit
code or grep for a "not supported" message on stderr, but these
methods are rather obscure.

The main advantage is that the feature message will automatically
appear in bug reports and other support requests.

This concept was also used during the development of Scalar for
similar reasons.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsmonitor--daemon: implement handle_client callback
Jeff Hostetler [Fri, 25 Mar 2022 18:03:01 +0000 (18:03 +0000)] 
fsmonitor--daemon: implement handle_client callback

Teach fsmonitor--daemon to respond to IPC requests from client
Git processes and respond with a list of modified pathnames
relative to the provided token.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocompat/fsmonitor/fsm-listen-darwin: implement FSEvent listener on MacOS
Jeff Hostetler [Fri, 25 Mar 2022 18:03:00 +0000 (18:03 +0000)] 
compat/fsmonitor/fsm-listen-darwin: implement FSEvent listener on MacOS

Implement file system event listener on MacOS using FSEvent,
CoreFoundation, and CoreServices.

Co-authored-by: Kevin Willford <Kevin.Willford@microsoft.com>
Co-authored-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocompat/fsmonitor/fsm-listen-darwin: add MacOS header files for FSEvent
Jeff Hostetler [Fri, 25 Mar 2022 18:02:59 +0000 (18:02 +0000)] 
compat/fsmonitor/fsm-listen-darwin: add MacOS header files for FSEvent

Include MacOS system declarations to allow us to use FSEvent and
CoreFoundation APIs.  We need different versions of the declarations
for GCC vs. clang because of compiler and header file conflicts.

While it is quite possible to #include Apple's CoreServices.h when
compiling C source code with clang, trying to build it with GCC
currently fails with this error:

In file included
   from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/...
   ...Library/Frameworks/Security.framework/Headers/AuthSession.h:32,
   from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/...
   ...Library/Frameworks/Security.framework/Headers/Security.h:42,
   from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/...
   ...Library/Frameworks/CoreServices.framework/Frameworks/...
   ...OSServices.framework/Headers/CSIdentity.h:43,
   from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/...
   ...Library/Frameworks/CoreServices.framework/Frameworks/...
   ...OSServices.framework/Headers/OSServices.h:29,
   from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/...
   ...Library/Frameworks/CoreServices.framework/Frameworks/...
   ...LaunchServices.framework/Headers/IconsCore.h:23,
   from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/...
   ...Library/Frameworks/CoreServices.framework/Frameworks/...
   ...LaunchServices.framework/Headers/LaunchServices.h:23,
   from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/...
   ...Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:45,

     /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/...
     ...Library/Frameworks/Security.framework/Headers/Authorization.h:193:7:
     error: variably modified 'bytes' at file scope
       193 | char bytes[kAuthorizationExternalFormLength];
           |      ^~~~~

The underlying reason is that GCC (rightfully) objects that an `enum`
value such as `kAuthorizationExternalFormLength` is not a constant
(because it is not, the preprocessor has no knowledge of it, only the
actual C compiler does) and can therefore not be used to define the size
of a C array.

This is a known problem and tracked in GCC's bug tracker:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93082

In the meantime, let's not block things and go the slightly ugly route
of declaring/defining the FSEvents constants, data structures and
functions that we need, so that we can avoid above-mentioned issue.

Let's do this _only_ for GCC, though, so that the CI/PR builds (which
build both with clang and with GCC) can guarantee that we _are_ using
the correct data types.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocompat/fsmonitor/fsm-listen-win32: implement FSMonitor backend on Windows
Jeff Hostetler [Fri, 25 Mar 2022 18:02:58 +0000 (18:02 +0000)] 
compat/fsmonitor/fsm-listen-win32: implement FSMonitor backend on Windows

Teach the win32 backend to register a watch on the working tree
root directory (recursively).  Also watch the <gitdir> if it is
not inside the working tree.  And to collect path change notifications
into batches and publish.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsmonitor--daemon: create token-based changed path cache
Jeff Hostetler [Fri, 25 Mar 2022 18:02:57 +0000 (18:02 +0000)] 
fsmonitor--daemon: create token-based changed path cache

Teach fsmonitor--daemon to build a list of changed paths and associate
them with a token-id.  This will be used by the platform-specific
backends to accumulate changed paths in response to filesystem events.

The platform-specific file system listener thread receives file system
events containing one or more changed pathnames (with whatever
bucketing or grouping that is convenient for the file system).  These
paths are accumulated (without locking) by the file system layer into
a `fsmonitor_batch`.

When the file system layer has drained the kernel event queue, it will
"publish" them to our token queue and make them visible to concurrent
client worker threads.  The token layer is free to combine and/or de-dup
paths within these batches for efficient presentation to clients.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsmonitor--daemon: define token-ids
Jeff Hostetler [Fri, 25 Mar 2022 18:02:56 +0000 (18:02 +0000)] 
fsmonitor--daemon: define token-ids

Teach fsmonitor--daemon to create token-ids and define the
overall token naming scheme.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsmonitor--daemon: add pathname classification
Jeff Hostetler [Fri, 25 Mar 2022 18:02:55 +0000 (18:02 +0000)] 
fsmonitor--daemon: add pathname classification

Teach fsmonitor--daemon to classify relative and absolute
pathnames and decide how they should be handled.  This will
be used by the platform-specific backend to respond to each
filesystem event.

When we register for filesystem notifications on a directory,
we get events for everything (recursively) in the directory.
We want to report to clients changes to tracked and untracked
paths within the working directory proper.  We do not want to
report changes within the .git directory, for example.

This classification will be used in a later commit by the
different backends to classify paths as events are received.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>