]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
3 years agoarchive tests: use a cheaper "zipinfo -h" invocation to get header
Ævar Arnfjörð Bjarmason [Sat, 23 Jan 2021 13:00:45 +0000 (14:00 +0100)] 
archive tests: use a cheaper "zipinfo -h" invocation to get header

Change an invocation of zipinfo added in 19ee29401d (t5004: test ZIP
archives with many entries, 2015-08-22) to simply ask zipinfo for the
header info, rather than spewing out info about the entire archive and
race to kill it with SIGPIPE due to the downstream "head -2".

I ran across this because I'm adding a "set -o pipefail" test
mode. This won't be needed for the version of the mode that I'm
introducing (which currently relies on a patch to GNU bash), but I
think this is a good idea anyway.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoupload-pack tests: avoid a non-zero "grep" exit status
Ævar Arnfjörð Bjarmason [Sat, 23 Jan 2021 13:00:44 +0000 (14:00 +0100)] 
upload-pack tests: avoid a non-zero "grep" exit status

Continue changing a test that 763b47bafa (t5703: stop losing return
codes of git commands, 2019-11-27) already refactored.

This was originally added as part of a series to add support for
running under bash's "set -o pipefail", under that mode this test will
fail because sometimes there's no commits in the "objs" output.

It's easier to fix that than exempt these tests under a hypothetical
"set -o pipefail" test mode. It looks like we probably won't have
that, but once we've dug this code up let's refactor it[2] so we don't
hide a potential pipe failure.

1. https://lore.kernel.org/git/xmqqzh18o8o6.fsf@gitster.c.googlers.com/

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogit-svn tests: rewrite brittle tests to use "--[no-]merges".
Jeff King [Sat, 23 Jan 2021 13:00:43 +0000 (14:00 +0100)] 
git-svn tests: rewrite brittle tests to use "--[no-]merges".

Rewrite a brittle tests which used "rev-list" without "--[no-]merges"
to figure out if a set of commits turned into merge commits or not.

Signed-off-by: Jeff King <peff@peff.net>
[ÆAB: wrote commit message]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogit svn mergeinfo tests: refactor "test -z" to use test_must_be_empty
Ævar Arnfjörð Bjarmason [Sat, 23 Jan 2021 13:00:42 +0000 (14:00 +0100)] 
git svn mergeinfo tests: refactor "test -z" to use test_must_be_empty

Refactor some old-style test code to use test_must_be_empty instead of
"test -z". This makes a follow-up commit easier to read.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogit svn mergeinfo tests: modernize redirection & quoting style
Ævar Arnfjörð Bjarmason [Sat, 23 Jan 2021 13:00:41 +0000 (14:00 +0100)] 
git svn mergeinfo tests: modernize redirection & quoting style

Use "<file" instead of "< file", and don't put the closing quote for
strings on an indented line. This makes a follow-up refactoring commit
easier to read.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocache-tree tests: explicitly test HEAD and index differences
Ævar Arnfjörð Bjarmason [Sat, 23 Jan 2021 13:00:40 +0000 (14:00 +0100)] 
cache-tree tests: explicitly test HEAD and index differences

The test code added in 9c4d6c0297 (cache-tree: Write updated
cache-tree after commit, 2014-07-13) used "ls-files" in lieu of
"ls-tree" because it wanted to test the data in the index, since this
test is testing the cache-tree extension.

Change the test to instead use "ls-tree" for traversal, and then
explicitly check how HEAD differs from the index. This is more easily
understood, and less fragile as numerous past bug fixes[1][2][3] to
the old code we're replacing demonstrate.

As an aside this would be a bit easier if empty pathspecs hadn't been
made an error in d426430e6e (pathspec: warn on empty strings as
pathspec, 2016-06-22) and 9e4e8a64c2 (pathspec: die on empty strings
as pathspec, 2017-06-06).

If that was still allowed this code could be simplified slightly:

diff --git a/t/t0090-cache-tree.sh b/t/t0090-cache-tree.sh
index 9bf66c9e68..0b02881f55 100755
--- a/t/t0090-cache-tree.sh
+++ b/t/t0090-cache-tree.sh
@@ -18,19 +18,18 @@ cmp_cache_tree () {
 # test-tool dump-cache-tree already verifies that all existing data is
 # correct.
 generate_expected_cache_tree () {
-       pathspec="$1" &&
-       dir="$2${2:+/}" &&
+       pathspec="$1${1:+/}" &&
        git ls-tree --name-only HEAD -- "$pathspec" >files &&
        git ls-tree --name-only -d HEAD -- "$pathspec" >subtrees &&
-       printf "SHA %s (%d entries, %d subtrees)\n" "$dir" $(wc -l <files) $(wc -l <subtrees) &&
+       printf "SHA %s (%d entries, %d subtrees)\n" "$pathspec" $(wc -l <files) $(wc -l <subtrees) &&
        while read subtree
        do
-               generate_expected_cache_tree "$pathspec/$subtree/" "$subtree" || return 1
+               generate_expected_cache_tree "$subtree" || return 1
        done <subtrees
 }

 test_cache_tree () {
-       generate_expected_cache_tree "." >expect &&
+       generate_expected_cache_tree >expect &&
        cmp_cache_tree expect &&
        rm expect actual files subtrees &&
        git status --porcelain -- ':!status' ':!expected.status' >status &&

1. c8db708d5d (t0090: avoid passing empty string to printf %d,
   2014-09-30)
2. d69360c6b1 (t0090: tweak awk statement for Solaris
   /usr/xpg4/bin/awk, 2014-12-22)
3. 9b5a9fa60a (t0090: stop losing return codes of git commands,
   2019-11-27)

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocache-tree tests: use a sub-shell with less indirection
Ævar Arnfjörð Bjarmason [Sat, 23 Jan 2021 13:00:39 +0000 (14:00 +0100)] 
cache-tree tests: use a sub-shell with less indirection

Change a "cd xyz && work && cd .." pattern introduced in
9c4d6c0297 (cache-tree: Write updated cache-tree after commit,
2014-07-13) to use a sub-shell instead with less indirection.

We did actually recover correctly if we failed in this function since
we were wrapped in a subshell one function call up. Let's just use the
sub-shell at the point where we want to change the directory
instead.

It's important that the "|| return 1" is outside the
subshell. Normally, we `exit 1` from within subshells[1], but that
wouldn't help us exit this loop early[1][2].

Since we can get rid of the wrapper function let's rename the main
function to drop the "rec" (for "recursion") suffix[3].

1. https://lore.kernel.org/git/CAPig+cToj8nQmyBCqC1k7DXF2vXaonCEA-fCJ4x7JBZG2ixYBw@mail.gmail.com/
2. https://lore.kernel.org/git/20150325052952.GE31924@peff.net/
3. https://lore.kernel.org/git/YARsCsgXuiXr4uFX@coredump.intra.peff.net/

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocache-tree tests: remove unused $2 parameter
Ævar Arnfjörð Bjarmason [Sat, 23 Jan 2021 13:00:38 +0000 (14:00 +0100)] 
cache-tree tests: remove unused $2 parameter

Remove the $2 paramater. This appears to have been some
work-in-progress code from an earlier version of
9c4d6c0297 (cache-tree: Write updated cache-tree after commit,
2014-07-13) which was left in the final version.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocache-tree tests: refactor for modern test style
Ævar Arnfjörð Bjarmason [Sat, 23 Jan 2021 13:00:37 +0000 (14:00 +0100)] 
cache-tree tests: refactor for modern test style

Refactor the cache-tree test file to use our current recommended
patterns. This makes a subsequent meaningful change easier to read.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoThe third batch
Junio C Hamano [Sat, 16 Jan 2021 05:48:20 +0000 (21:48 -0800)] 
The third batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'jc/macos-install-dependencies-fix'
Junio C Hamano [Sat, 16 Jan 2021 05:48:47 +0000 (21:48 -0800)] 
Merge branch 'jc/macos-install-dependencies-fix'

Fix for procedure to building CI test environment for mac.

* jc/macos-install-dependencies-fix:
  ci/install-depends: attempt to fix "brew cask" stuff

3 years agoMerge branch 'tb/local-clone-race-doc'
Junio C Hamano [Sat, 16 Jan 2021 05:48:47 +0000 (21:48 -0800)] 
Merge branch 'tb/local-clone-race-doc'

Doc update.

* tb/local-clone-race-doc:
  Documentation/git-clone.txt: document race with --local

3 years agoMerge branch 'bc/doc-status-short'
Junio C Hamano [Sat, 16 Jan 2021 05:48:47 +0000 (21:48 -0800)] 
Merge branch 'bc/doc-status-short'

Doc update.

* bc/doc-status-short:
  docs: rephrase and clarify the git status --short format

3 years agoMerge branch 'dl/p4-encode-after-kw-expansion'
Junio C Hamano [Sat, 16 Jan 2021 05:48:47 +0000 (21:48 -0800)] 
Merge branch 'dl/p4-encode-after-kw-expansion'

Text encoding fix for "git p4".

* dl/p4-encode-after-kw-expansion:
  git-p4: fix syncing file types with pattern

3 years agoMerge branch 'ab/gettext-charset-comment-fix'
Junio C Hamano [Sat, 16 Jan 2021 05:48:46 +0000 (21:48 -0800)] 
Merge branch 'ab/gettext-charset-comment-fix'

Comments update.

* ab/gettext-charset-comment-fix:
  gettext.c: remove/reword a mostly-useless comment
  Makefile: remove a warning about old GETTEXT_POISON flag

3 years agoMerge branch 'ug/doc-lose-dircache'
Junio C Hamano [Sat, 16 Jan 2021 05:48:46 +0000 (21:48 -0800)] 
Merge branch 'ug/doc-lose-dircache'

Doc update.

* ug/doc-lose-dircache:
  doc: remove "directory cache" from man pages

3 years agoMerge branch 'ad/t4129-setfacl-target-fix'
Junio C Hamano [Sat, 16 Jan 2021 05:48:46 +0000 (21:48 -0800)] 
Merge branch 'ad/t4129-setfacl-target-fix'

Test fix.

* ad/t4129-setfacl-target-fix:
  t4129: fix setfacl-related permissions failure

3 years agoMerge branch 'jk/t5516-deflake'
Junio C Hamano [Sat, 16 Jan 2021 05:48:46 +0000 (21:48 -0800)] 
Merge branch 'jk/t5516-deflake'

Test fix.

* jk/t5516-deflake:
  t5516: loosen "not our ref" error check

3 years agoMerge branch 'vv/send-email-with-less-secure-apps-access'
Junio C Hamano [Sat, 16 Jan 2021 05:48:46 +0000 (21:48 -0800)] 
Merge branch 'vv/send-email-with-less-secure-apps-access'

Doc update.

* vv/send-email-with-less-secure-apps-access:
  git-send-email.txt: mention less secure app access with Gmail

3 years agoMerge branch 'pb/mergetool-tool-help-fix'
Junio C Hamano [Sat, 16 Jan 2021 05:48:46 +0000 (21:48 -0800)] 
Merge branch 'pb/mergetool-tool-help-fix'

Fix 2.29 regression where "git mergetool --tool-help" fails to list
all the available tools.

* pb/mergetool-tool-help-fix:
  mergetool--lib: fix '--tool-help' to correctly show available tools

3 years agoMerge branch 'ds/for-each-repo-noopfix'
Junio C Hamano [Sat, 16 Jan 2021 05:48:45 +0000 (21:48 -0800)] 
Merge branch 'ds/for-each-repo-noopfix'

"git for-each-repo --config=<var> <cmd>" should not run <cmd> for
any repository when the configuration variable <var> is not defined
even once.

* ds/for-each-repo-noopfix:
  for-each-repo: do nothing on empty config

3 years agoMerge branch 'jc/sign-off'
Junio C Hamano [Sat, 16 Jan 2021 05:48:45 +0000 (21:48 -0800)] 
Merge branch 'jc/sign-off'

Doc update.

* jc/sign-off:
  SubmittingPatches: tighten wording on "sign-off" procedure

3 years agoMerge branch 'mt/t4129-with-setgid-dir'
Junio C Hamano [Sat, 16 Jan 2021 05:48:45 +0000 (21:48 -0800)] 
Merge branch 'mt/t4129-with-setgid-dir'

Some tests expect that "ls -l" output has either '-' or 'x' for
group executable bit, but setgid bit can be inherited from parent
directory and make these fields 'S' or 's' instead, causing test
failures.

* mt/t4129-with-setgid-dir:
  t4129: don't fail if setgid is set in the test directory

3 years agoMerge branch 'ds/maintenance-part-4'
Junio C Hamano [Sat, 16 Jan 2021 05:48:45 +0000 (21:48 -0800)] 
Merge branch 'ds/maintenance-part-4'

Follow-up on the "maintenance part-3" which introduced scheduled
maintenance tasks to support platforms whose native scheduling
methods are not 'cron'.

* ds/maintenance-part-4:
  maintenance: use Windows scheduled tasks
  maintenance: use launchctl on macOS
  maintenance: include 'cron' details in docs
  maintenance: extract platform-specific scheduling

3 years agoThe second batch
Junio C Hamano [Fri, 15 Jan 2021 23:03:23 +0000 (15:03 -0800)] 
The second batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'fc/completion-aliases-support'
Junio C Hamano [Fri, 15 Jan 2021 23:20:29 +0000 (15:20 -0800)] 
Merge branch 'fc/completion-aliases-support'

Bash completion (in contrib/) update to make it easier for
end-users to add completion for their custom "git" subcommands.

* fc/completion-aliases-support:
  completion: add proper public __git_complete
  test: completion: add tests for __git_complete
  completion: bash: improve function detection
  completion: bash: add __git_have_func helper

3 years agoMerge branch 'en/stash-apply-sparse-checkout'
Junio C Hamano [Fri, 15 Jan 2021 23:20:29 +0000 (15:20 -0800)] 
Merge branch 'en/stash-apply-sparse-checkout'

"git stash" did not work well in a sparsely checked out working
tree.

* en/stash-apply-sparse-checkout:
  stash: fix stash application in sparse-checkouts
  stash: remove unnecessary process forking
  t7012: add a testcase demonstrating stash apply bugs in sparse checkouts

3 years agoMerge branch 'ar/t6016-modernise'
Junio C Hamano [Fri, 15 Jan 2021 23:20:29 +0000 (15:20 -0800)] 
Merge branch 'ar/t6016-modernise'

Test update.

* ar/t6016-modernise:
  t6016: move to lib-log-graph.sh framework

3 years agoMerge branch 'zh/arg-help-format'
Junio C Hamano [Fri, 15 Jan 2021 23:20:29 +0000 (15:20 -0800)] 
Merge branch 'zh/arg-help-format'

Clean up option descriptions in "git cmd --help".

* zh/arg-help-format:
  builtin/*: update usage format
  parse-options: format argh like error messages

3 years agoMerge branch 'nk/perf-fsmonitor-cleanup'
Junio C Hamano [Fri, 15 Jan 2021 23:20:29 +0000 (15:20 -0800)] 
Merge branch 'nk/perf-fsmonitor-cleanup'

Test fix.

* nk/perf-fsmonitor-cleanup:
  p7519: allow running without watchman prereq

3 years agoMerge branch 'ds/trace2-topo-walk'
Junio C Hamano [Fri, 15 Jan 2021 23:20:29 +0000 (15:20 -0800)] 
Merge branch 'ds/trace2-topo-walk'

The topological walk codepath is covered by new trace2 stats.

* ds/trace2-topo-walk:
  revision: trace topo-walk statistics

3 years agoMerge branch 'rs/rebase-commit-validation'
Junio C Hamano [Fri, 15 Jan 2021 23:20:29 +0000 (15:20 -0800)] 
Merge branch 'rs/rebase-commit-validation'

Diagnose command line error of "git rebase" early.

* rs/rebase-commit-validation:
  rebase: verify commit parameter

3 years agoMerge branch 'ma/sha1-is-a-hash'
Junio C Hamano [Fri, 15 Jan 2021 23:20:29 +0000 (15:20 -0800)] 
Merge branch 'ma/sha1-is-a-hash'

Retire more names with "sha1" in it.

* ma/sha1-is-a-hash:
  hash-lookup: rename from sha1-lookup
  sha1-lookup: rename `sha1_pos()` as `hash_pos()`
  object-file.c: rename from sha1-file.c
  object-name.c: rename from sha1-name.c

3 years agoMerge branch 'ma/doc-pack-format-varint-for-sizes'
Junio C Hamano [Fri, 15 Jan 2021 23:20:28 +0000 (15:20 -0800)] 
Merge branch 'ma/doc-pack-format-varint-for-sizes'

Doc update.

* ma/doc-pack-format-varint-for-sizes:
  pack-format.txt: document sizes at start of delta data

3 years agoMerge branch 'ma/t1300-cleanup'
Junio C Hamano [Fri, 15 Jan 2021 23:20:28 +0000 (15:20 -0800)] 
Merge branch 'ma/t1300-cleanup'

Code clean-up.

* ma/t1300-cleanup:
  t1300: don't needlessly work with `core.foo` configs
  t1300: remove duplicate test for `--file no-such-file`
  t1300: remove duplicate test for `--file ../foo`

3 years agoMerge branch 'pb/doc-modules-git-work-tree-typofix'
Junio C Hamano [Fri, 15 Jan 2021 23:20:28 +0000 (15:20 -0800)] 
Merge branch 'pb/doc-modules-git-work-tree-typofix'

Doc fix.

* pb/doc-modules-git-work-tree-typofix:
  gitmodules.txt: fix 'GIT_WORK_TREE' variable name

3 years agoMerge branch 'ta/doc-typofix'
Junio C Hamano [Fri, 15 Jan 2021 23:20:28 +0000 (15:20 -0800)] 
Merge branch 'ta/doc-typofix'

Doc fix.

* ta/doc-typofix:
  doc: fix some typos

3 years agoMerge branch 'bc/rev-parse-path-format'
Junio C Hamano [Fri, 15 Jan 2021 23:20:28 +0000 (15:20 -0800)] 
Merge branch 'bc/rev-parse-path-format'

"git rev-parse" can be explicitly told to give output as absolute
or relative path with the `--path-format=(absolute|relative)` option.

* bc/rev-parse-path-format:
  rev-parse: add option for absolute or relative path formatting
  abspath: add a function to resolve paths with missing components

3 years agoMerge branch 'ew/decline-core-abbrev'
Junio C Hamano [Fri, 15 Jan 2021 23:20:28 +0000 (15:20 -0800)] 
Merge branch 'ew/decline-core-abbrev'

The configuration variable 'core.abbrev' can be set to 'no' to
force no abbreviation regardless of the hash algorithm.

* ew/decline-core-abbrev:
  core.abbrev=no disables abbreviations

3 years agoci/install-depends: attempt to fix "brew cask" stuff
Junio C Hamano [Fri, 15 Jan 2021 02:51:02 +0000 (18:51 -0800)] 
ci/install-depends: attempt to fix "brew cask" stuff

We run "git pull" against "$cask_repo"; clarify that we are
expecting not to have any of our own modifications and running "git
pull" to merely update, by passing "--ff-only" on the command line.

Also, the "brew cask install" command line triggers an error message
that says:

    Error: Calling brew cask install is disabled! Use brew install
    [--cask] instead.

In addition, "brew install caskroom/cask/perforce" step triggers an
error that says:

    Error: caskroom/cask was moved. Tap homebrew/cask instead.

Attempt to see if blindly following the suggestion in these error
messages gets us into a better shape.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoDocumentation/git-clone.txt: document race with --local
Taylor Blau [Mon, 11 Jan 2021 19:25:10 +0000 (14:25 -0500)] 
Documentation/git-clone.txt: document race with --local

When running 'git clone --local', the operation may fail if another
process is modifying the source repository. Document that this race
condition is known to hopefully help anyone who may run into it.

Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogettext.c: remove/reword a mostly-useless comment
Ævar Arnfjörð Bjarmason [Mon, 11 Jan 2021 13:14:51 +0000 (14:14 +0100)] 
gettext.c: remove/reword a mostly-useless comment

Mostly remove the comment I added 5e9637c6297 (i18n: add
infrastructure for translating Git with gettext, 2011-11-18). Since
then we had a fix in 9c0495d23e6 (gettext.c: detect the vsnprintf bug
at runtime, 2013-12-01) so we're not running with the "set back to C
locale" hack on any modern system.

So having more than 1/4 of the file taken up by a digression about a
glibc bug that mostly doesn't happen to anyone anymore is just a
needless distraction. Shorten the comment to make a brief mention of
the bug, and where to find more info by looking at the git history for
this now-removed comment.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMakefile: remove a warning about old GETTEXT_POISON flag
Ævar Arnfjörð Bjarmason [Mon, 11 Jan 2021 13:14:50 +0000 (14:14 +0100)] 
Makefile: remove a warning about old GETTEXT_POISON flag

Remove a migratory warning I added in 6cdccfce1e0 (i18n: make
GETTEXT_POISON a runtime option, 2018-11-08) to give anyone using that
option in their builds a heads-up about the change from compile-time
to runtime introduced in that commit.

It's been more than 2 years since then, anyone who ran into this is
likely to have made a change as a result, so removing this is long
overdue.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agodocs: rephrase and clarify the git status --short format
brian m. carlson [Sun, 10 Jan 2021 19:04:48 +0000 (19:04 +0000)] 
docs: rephrase and clarify the git status --short format

The table describing the porcelain format in git-status(1) is helpful,
but it's not completely clear what the three sections mean, even to
some contributors.  As a result, users are unable to find how to detect
common cases like merge conflicts programmatically.

Let's improve this situation by rephrasing to be more explicit about
what each of the sections in the table means, to tell users in plain
language which cases are occurring, and to describe what "unmerged"
means.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agodoc: remove "directory cache" from man pages
Utku Gultopu [Fri, 8 Jan 2021 16:54:56 +0000 (16:54 +0000)] 
doc: remove "directory cache" from man pages

"directory cache" (or "directory cache index", "cache") are obsolete
terms which have been superseded by "index". Keeping them in the
documentation may be a source of confusion. This commit replaces
them with the current term, "index", on man pages.

Signed-off-by: Utku Gultopu <ugultopu@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot5516: loosen "not our ref" error check
Jeff King [Sun, 10 Jan 2021 03:23:09 +0000 (22:23 -0500)] 
t5516: loosen "not our ref" error check

Commit 014ade7484 (upload-pack: send ERR packet for non-tip objects,
2019-04-13) added a test that greps the output of a failed fetch to make
sure that upload-pack sent us the ERR packet we expected. But checking
this is racy; despite the argument in that commit, the client may still
be sending a "done" line after the server exits, causing it to die() on
a failed write() and never see the ERR packet at all.

This fails quite rarely on Linux, but more often on macOS. However, it
can be triggered reliably with:

diff --git a/fetch-pack.c b/fetch-pack.c
index 876f90c759..cf40de9092 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -489,6 +489,7 @@ static int find_common(struct fetch_negotiator *negotiator,
 done:
  trace2_region_leave("fetch-pack", "negotiation_v0_v1", the_repository);
  if (!got_ready || !no_done) {
+ sleep(1);
  packet_buf_write(&req_buf, "done\n");
  send_request(args, fd[1], &req_buf);
  }

This is a real user-visible race that it would be nice to fix, but it's
tricky to do so: the client would have to speculatively try to read an
ERR packet after hitting a write() error. And at least for this error,
it's specific to v0 (since v2 does not enforce reachability at all).

So let's loosen the test to avoid annoying racy failures. If we
eventually do the read-after-failed-write thing, we can tighten it. And
if not, v0 will grow increasingly obsolete as servers support v2, so the
utility of this test will decrease over time anyway.

Note that we can still check stderr to make sure upload-pack bailed for
the reason we expected. It writes a similar message to stderr, and
because the server side is just another process connected by pipes,
we'll reliably see it. This would not be the case for git://, or for
ssh servers that do not relay stderr (e.g., GitHub's custom endpoint
does not).

Helped-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot4129: fix setfacl-related permissions failure
Adam Dinwoodie [Wed, 23 Dec 2020 11:44:31 +0000 (11:44 +0000)] 
t4129: fix setfacl-related permissions failure

When running this test in Cygwin, it's necessary to remove the inherited
access control lists from the Git working directory in order for later
permissions tests to work as expected.

As such, fix an error in the test script so that the ACLs are set for
the working directory, not a nonexistent subdirectory.

Signed-off-by: Adam Dinwoodie <adam@dinwoodie.org>
Reviewed-by: Matheus Tavares <matheus.bernardino@usp.br>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogit-send-email.txt: mention less secure app access with Gmail
Vasyl Vavrychuk [Fri, 8 Jan 2021 04:17:17 +0000 (20:17 -0800)] 
git-send-email.txt: mention less secure app access with Gmail

Google may have changed Gmail security and now less secure app access
needs to be explicitly enabled if two-factor authentication is not in
place, otherwise send-email fails with:

5.7.8 Username and Password not accepted. Learn more at
5.7.8  https://support.google.com/mail/?p=BadCredentials

Document steps required to make this work.

Signed-off-by: Vasyl Vavrychuk <vvavrychuk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
[dl: Clean up commit message and incorporate suggestions into patch.]
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agofor-each-repo: do nothing on empty config
Derrick Stolee [Fri, 8 Jan 2021 02:30:46 +0000 (02:30 +0000)] 
for-each-repo: do nothing on empty config

'git for-each-repo --config=X' should return success without calling any
subcommands when the config key 'X' has no value. The current
implementation instead segfaults.

A user could run into this issue if they used 'git maintenance start' to
initialize their cron schedule using 'git for-each-repo
--config=maintenance.repo ...' but then using 'git maintenance
unregister' to remove the config option. (Note: 'git maintenance stop'
would remove the config _and_ remove the cron schedule.)

Add a simple test to ensure this works. Use 'git help --no-such-option'
as the potential subcommand to ensure that we will hit a failure if the
subcommand is ever run.

Reported-by: Andreas Bühmann <dev@uuml.de>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoSubmittingPatches: tighten wording on "sign-off" procedure
Junio C Hamano [Thu, 7 Jan 2021 23:38:09 +0000 (15:38 -0800)] 
SubmittingPatches: tighten wording on "sign-off" procedure

The text says "if you can certify DCO then you add a Signed-off-by
trailer".  But it does not say anything about people who cannot or
do not want to certify.  A natural reading may be that if you do not
certify, you must not add the trailer, but it shouldn't hurt to be
overly explicit.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoThe first batch in 2.31 cycle
Junio C Hamano [Thu, 7 Jan 2021 07:22:15 +0000 (23:22 -0800)] 
The first batch in 2.31 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'es/perf-export-fix'
Junio C Hamano [Thu, 7 Jan 2021 07:33:44 +0000 (23:33 -0800)] 
Merge branch 'es/perf-export-fix'

Tweak unneeded recursion from a test framework helper function.

* es/perf-export-fix:
  t/perf: avoid unnecessary test_export() recursion

3 years agoMerge branch 'fc/t6030-bisect-reset-removes-auxiliary-files'
Junio C Hamano [Thu, 7 Jan 2021 07:33:44 +0000 (23:33 -0800)] 
Merge branch 'fc/t6030-bisect-reset-removes-auxiliary-files'

A 3-year old test that was not testing anything useful has been
corrected.

* fc/t6030-bisect-reset-removes-auxiliary-files:
  test: bisect-porcelain: fix location of files

3 years agoMerge branch 'es/worktree-repair-both-moved'
Junio C Hamano [Thu, 7 Jan 2021 07:33:44 +0000 (23:33 -0800)] 
Merge branch 'es/worktree-repair-both-moved'

"git worktree repair" learned to deal with the case where both the
repository and the worktree moved.

* es/worktree-repair-both-moved:
  worktree: teach `repair` to fix multi-directional breakage

3 years agoMerge branch 'en/merge-ort-recursive'
Junio C Hamano [Thu, 7 Jan 2021 07:33:44 +0000 (23:33 -0800)] 
Merge branch 'en/merge-ort-recursive'

The ORT merge strategy learned to synthesize virtual ancestor tree
by recursively merging multiple merge bases together, just like the
recursive backend has done for years.

* en/merge-ort-recursive:
  merge-ort: implement merge_incore_recursive()
  merge-ort: make clear_internal_opts() aware of partial clearing
  merge-ort: copy a few small helper functions from merge-recursive.c
  commit: move reverse_commit_list() from merge-recursive

3 years agoMerge branch 'fc/pull-merge-rebase'
Junio C Hamano [Thu, 7 Jan 2021 07:33:44 +0000 (23:33 -0800)] 
Merge branch 'fc/pull-merge-rebase'

When a user does not tell "git pull" to use rebase or merge, the
command gives a loud message telling a user to choose between
rebase or merge but creates a merge anyway, forcing users who would
want to rebase to redo the operation.  Fix an early part of this
problem by tightening the condition to give the message---there is
no reason to stop or force the user to choose between rebase or
merge if the history fast-forwards.

* fc/pull-merge-rebase:
  pull: display default warning only when non-ff
  pull: correct condition to trigger non-ff advice
  pull: get rid of unnecessary global variable
  pull: give the advice for choosing rebase/merge much later
  pull: refactor fast-forward check

3 years agoMerge branch 'en/merge-ort-2'
Junio C Hamano [Thu, 7 Jan 2021 07:33:44 +0000 (23:33 -0800)] 
Merge branch 'en/merge-ort-2'

More "ORT" merge strategy.

* en/merge-ort-2:
  merge-ort: add modify/delete handling and delayed output processing
  merge-ort: add die-not-implemented stub handle_content_merge() function
  merge-ort: add function grouping comments
  merge-ort: add a paths_to_free field to merge_options_internal
  merge-ort: add a path_conflict field to merge_options_internal
  merge-ort: add a clear_internal_opts helper
  merge-ort: add a few includes

3 years agoMerge branch 'en/merge-ort-impl'
Junio C Hamano [Thu, 7 Jan 2021 07:33:43 +0000 (23:33 -0800)] 
Merge branch 'en/merge-ort-impl'

The merge backend "done right" starts to emerge.

* en/merge-ort-impl:
  merge-ort: free data structures in merge_finalize()
  merge-ort: add implementation of record_conflicted_index_entries()
  tree: enable cmp_cache_name_compare() to be used elsewhere
  merge-ort: add implementation of checkout()
  merge-ort: basic outline for merge_switch_to_result()
  merge-ort: step 3 of tree writing -- handling subdirectories as we go
  merge-ort: step 2 of tree writing -- function to create tree object
  merge-ort: step 1 of tree writing -- record basenames, modes, and oids
  merge-ort: have process_entries operate in a defined order
  merge-ort: add a preliminary simple process_entries() implementation
  merge-ort: avoid recursing into identical trees
  merge-ort: record stage and auxiliary info for every path
  merge-ort: compute a few more useful fields for collect_merge_info
  merge-ort: avoid repeating fill_tree_descriptor() on the same tree
  merge-ort: implement a very basic collect_merge_info()
  merge-ort: add an err() function similar to one from merge-recursive
  merge-ort: use histogram diff
  merge-ort: port merge_start() from merge-recursive
  merge-ort: add some high-level algorithm structure
  merge-ort: setup basic internal data structures

3 years agoMerge branch 'tb/pack-bitmap'
Junio C Hamano [Thu, 7 Jan 2021 07:33:43 +0000 (23:33 -0800)] 
Merge branch 'tb/pack-bitmap'

Various improvements to the codepath that writes out pack bitmaps.

* tb/pack-bitmap: (24 commits)
  pack-bitmap-write: better reuse bitmaps
  pack-bitmap-write: relax unique revwalk condition
  pack-bitmap-write: use existing bitmaps
  pack-bitmap: factor out 'add_commit_to_bitmap()'
  pack-bitmap: factor out 'bitmap_for_commit()'
  pack-bitmap-write: ignore BITMAP_FLAG_REUSE
  pack-bitmap-write: build fewer intermediate bitmaps
  pack-bitmap.c: check reads more aggressively when loading
  pack-bitmap-write: rename children to reverse_edges
  t5310: add branch-based checks
  commit: implement commit_list_contains()
  bitmap: implement bitmap_is_subset()
  pack-bitmap-write: fill bitmap with commit history
  pack-bitmap-write: pass ownership of intermediate bitmaps
  pack-bitmap-write: reimplement bitmap writing
  ewah: add bitmap_dup() function
  ewah: implement bitmap_or()
  ewah: make bitmap growth less aggressive
  ewah: factor out bitmap growth
  rev-list: die when --test-bitmap detects a mismatch
  ...

3 years agoMerge branch 'ab/trailers-extra-format'
Junio C Hamano [Thu, 7 Jan 2021 07:33:43 +0000 (23:33 -0800)] 
Merge branch 'ab/trailers-extra-format'

The "--format=%(trailers)" mechanism gets enhanced to make it
easier to design output for machine consumption.

* ab/trailers-extra-format:
  pretty format %(trailers): add a "key_value_separator"
  pretty format %(trailers): add a "keyonly"
  pretty-format %(trailers): fix broken standalone "valueonly"
  pretty format %(trailers) doc: avoid repetition
  pretty format %(trailers) test: split a long line

3 years agoMerge branch 'pk/subsub-fetch-fix-take-2'
Junio C Hamano [Thu, 7 Jan 2021 07:33:43 +0000 (23:33 -0800)] 
Merge branch 'pk/subsub-fetch-fix-take-2'

"git fetch --recurse-submodules" fix (second attempt).

* pk/subsub-fetch-fix-take-2:
  submodules: fix of regression on fetching of non-init subsub-repo

3 years agomergetool--lib: fix '--tool-help' to correctly show available tools
Philippe Blain [Thu, 7 Jan 2021 01:09:05 +0000 (01:09 +0000)] 
mergetool--lib: fix '--tool-help' to correctly show available tools

Commit 83bbf9b92e (mergetool--lib: improve support for vimdiff-style tool
variants, 2020-07-29) introduced a regression in the output of `git mergetool
--tool-help` and `git difftool --tool-help` [1].

In function 'show_tool_names' in git-mergetool--lib.sh, we loop over the
supported mergetools and their variants and accumulate them in the variable
'variants', separating them with a literal '\n'.

The code then uses 'echo $variants' to turn these '\n' into newlines, but this
behaviour is not portable, it just happens to work in some shells, like
dash(1)'s 'echo' builtin.

For shells in which 'echo' does not turn '\n' into newlines, the end
result is that the only tools that are shown are the existing variants
(except the last variant alphabetically), since the variants are
separated by actual newlines in '$variants' because of the several
'echo' calls in mergetools/{bc,vimdiff}::list_tool_variants.

Fix this bug by embedding an actual line feed into `variants` in
show_tool_names(). While at it, replace `sort | uniq` by `sort -u`.

To prevent future regressions, add a simple test that checks that a few
known tools are correctly shown (let's avoid counting the total number
of tools to lessen the maintenance burden when new tools are added or if
'--tool-help' learns additional logic, like hiding tools depending on
the current platform).

[1] https://lore.kernel.org/git/CADtb9DyozjgAsdFYL8fFBEWmq7iz4=prZYVUdH9W-J5CKVS4OA@mail.gmail.com/

Reported-by: Philippe Blain <levraiphilippeblain@gmail.com>
Based-on-patch-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot4129: don't fail if setgid is set in the test directory
Matheus Tavares [Tue, 5 Jan 2021 15:47:39 +0000 (12:47 -0300)] 
t4129: don't fail if setgid is set in the test directory

The last test of t4129 creates a directory and expects its setgid bit
(g+s) to be off. But this makes the test fail when the parent directory
has the bit set, as setgid's state is inherited by newly created
subdirectories.

One way to solve this problem is to allow the presence of this bit when
comparing the return of `test_modebits` with the expected value. But
then we may have the same problem in the future when other tests start
using `test_modebits` on directories (currently t4129 is the only one)
and forget about setgid. Instead, let's make the helper function more
robust with respect to the state of the setgid bit in the test directory
by removing this bit from the returning value. There should be no
problem with existing callers as no one currently expects this bit to be
on.

Note that the sticky bit (+t) and the setuid bit (u+s) are not
inherited, so we don't have to worry about those.

Reported-by: Kevin Daudt <me@ikke.info>
Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agobuiltin/*: update usage format
ZheNing Hu [Wed, 6 Jan 2021 14:44:03 +0000 (14:44 +0000)] 
builtin/*: update usage format

According to the guidelines in parse-options.h,
we should not end in a full stop or start with
a capital letter. Fix old error and usage
messages to match this expectation.

Signed-off-by: ZheNing Hu <adlternative@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoparse-options: format argh like error messages
Junio C Hamano [Wed, 6 Jan 2021 14:44:02 +0000 (14:44 +0000)] 
parse-options: format argh like error messages

"Keep it homogeneous across the repository" is in general a
guideline that can be used to converge to a good practice, but
we can be a bit more prescriptive in this case.  Just like the
messages we give die(_("...")) are formatted without the final
full stop and without the initial capitalization, most of the
argument help text are already formatted that way, and we want
to encourage that as the house style.

Noticed-by: ZheNing Hu <adlternative@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: ZheNing Hu <adlternative@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agop7519: allow running without watchman prereq
Taylor Blau [Mon, 4 Jan 2021 21:35:37 +0000 (16:35 -0500)] 
p7519: allow running without watchman prereq

p7519 measures the performance of the fsmonitor code. To do this, it
uses the installed copy of Watchman. If Watchman isn't installed, a noop
integration script is installed in its place.

When in the latter mode, it is expected that the script should not write
a "last update token": in fact, it doesn't write anything at all since
the script is blank.

Commit 33226af42b (t/perf/fsmonitor: improve error message if typoing
hook name, 2020-10-26) made sure that running 'git update-index
--fsmonitor' did not write anything to stderr, but this is not the case
when using the empty Watchman script, since Git will complain that:

    $ which watchman
    watchman not found
    $ cat .git/hooks/fsmonitor-empty
    $ git -c core.fsmonitor=.git/hooks/fsmonitor-empty update-index --fsmonitor
    warning: Empty last update token.

Prior to 33226af42b, the output wasn't checked at all, which allowed
this noop mode to work. But, 33226af42b breaks p7519 when running it
without a 'watchman(1)' on your system.

Handle this by only checking that the stderr is empty only when running
with a real watchman executable. Otherwise, assert that the error
message is the expected one when running in the noop mode.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Acked-by: Nipunn Koorapati <nipunn@dropbox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agomaintenance: use Windows scheduled tasks
Derrick Stolee [Tue, 5 Jan 2021 13:08:28 +0000 (13:08 +0000)] 
maintenance: use Windows scheduled tasks

Git's background maintenance uses cron by default, but this is not
available on Windows. Instead, integrate with Task Scheduler.

Tasks can be scheduled using the 'schtasks' command. There are several
command-line options that can allow for some advanced scheduling, but
unfortunately these seem to all require authenticating using a password.

Instead, use the "/xml" option to pass an XML file that contains the
configuration for the necessary schedule. These XML files are based on
some that I exported after constructing a schedule in the Task Scheduler
GUI. These options only run background maintenance when the user is
logged in, and more fields are populated with the current username and
SID at run-time by 'schtasks'.

Since the GIT_TEST_MAINT_SCHEDULER environment variable allows us to
specify 'schtasks' as the scheduler, we can test the Windows-specific
logic on other platforms. Thus, add a check that the XML file written
by Git is valid when xmllint exists on the system.

Since we use a temporary file for the XML files sent to 'schtasks', we
prefix the random characters with the frequency so it is easier to
examine the proper file during tests. Instead of an exact match on the
'args' file, we 'grep' for the arguments other than the filename.

There is a deficiency in the current design. Windows has two kinds of
applications: GUI applications that start by "winmain()" and console
applications that start by "main()". Console applications are attached
to a new Console window if they are not already associated with a GUI
application. This means that every hour the scheudled task launches a
command window for the scheduled tasks. Not only is this visually
obtrusive, but it also takes focus from whatever else the user is
doing!

A simple fix would be to insert a GUI application that acts as a shim
between the scheduled task and Git. This is currently possible in Git
for Windows by setting the <Command> tag equal to

  C:\Program Files\Git\git-bash.exe

with options "--hide --no-needs-console --command=cmd\git.exe"
followed by the arguments currently used. Since git-bash.exe is not
included in Windows builds of core Git, I chose to leave out this
feature. My plan is to submit a small patch to Git for Windows that
converts the use of git.exe with this use of git-bash.exe in the
short term. In the long term, we can consider creating this GUI
shim application within core Git, perhaps in contrib/.

Co-authored-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agomaintenance: use launchctl on macOS
Derrick Stolee [Tue, 5 Jan 2021 13:08:27 +0000 (13:08 +0000)] 
maintenance: use launchctl on macOS

The existing mechanism for scheduling background maintenance is done
through cron. The 'crontab -e' command allows updating the schedule
while cron itself runs those commands. While this is technically
supported by macOS, it has some significant deficiencies:

1. Every run of 'crontab -e' must request elevated privileges through
   the user interface. When running 'git maintenance start' from the
   Terminal app, it presents a dialog box saying "Terminal.app would
   like to administer your computer. Administration can include
   modifying passwords, networking, and system settings." This is more
   alarming than what we are hoping to achieve. If this alert had some
   information about how "git" is trying to run "crontab" then we would
   have some reason to believe that this dialog might be fine. However,
   it also doesn't help that some scenarios just leave Git waiting for
   a response without presenting anything to the user. I experienced
   this when executing the command from a Bash terminal view inside
   Visual Studio Code.

2. While cron initializes a user environment enough for "git config
   --global --show-origin" to show the correct config file information,
   it does not set up the environment enough for Git Credential Manager
   Core to load credentials during a 'prefetch' task. My prefetches
   against private repositories required re-authenticating through UI
   pop-ups in a way that should not be required.

The solution is to switch from cron to the Apple-recommended [1]
'launchd' tool.

[1] https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/ScheduledJobs.html

The basics of this tool is that we need to create XML-formatted
"plist" files inside "~/Library/LaunchAgents/" and then use the
'launchctl' tool to make launchd aware of them. The plist files
include all of the scheduling information, along with the command-line
arguments split across an array of <string> tags.

For example, here is my plist file for the weekly scheduled tasks:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"><dict>
<key>Label</key><string>org.git-scm.git.weekly</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/libexec/git-core/git</string>
<string>--exec-path=/usr/local/libexec/git-core</string>
<string>for-each-repo</string>
<string>--config=maintenance.repo</string>
<string>maintenance</string>
<string>run</string>
<string>--schedule=weekly</string>
</array>
<key>StartCalendarInterval</key>
<array>
<dict>
<key>Day</key><integer>0</integer>
<key>Hour</key><integer>0</integer>
<key>Minute</key><integer>0</integer>
</dict>
</array>
</dict>
</plist>

The schedules for the daily and hourly tasks are more complicated
since we need to use an array for the StartCalendarInterval with
an entry for each of the six days other than the 0th day (to avoid
colliding with the weekly task), and each of the 23 hours other
than the 0th hour (to avoid colliding with the daily task).

The "Label" value is currently filled with "org.git-scm.git.X"
where X is the frequency. We need a different plist file for each
frequency.

The launchctl command needs to be aligned with a user id in order
to initialize the command environment. This must be done using
the 'launchctl bootstrap' subcommand. This subcommand is new as
of macOS 10.11, which was released in September 2015. Before that
release the 'launchctl load' subcommand was recommended. The best
source of information on this transition I have seen is available
at [2]. The current design does not preclude a future version that
detects the available fatures of 'launchctl' to use the older
commands. However, it is best to rely on the newest version since
Apple might completely remove the deprecated version on short
notice.

[2] https://babodee.wordpress.com/2016/04/09/launchctl-2-0-syntax/

To remove a schedule, we must run 'launchctl bootout' with a valid
plist file. We also need to 'bootout' a task before the 'bootstrap'
subcommand will succeed, if such a task already exists.

The need for a user id requires us to run 'id -u' which works on
POSIX systems but not Windows. Further, the need for fully-qualitifed
path names including $HOME behaves differently in the Git internals and
the external test suite. The $HOME variable starts with "C:\..." instead
of the "/c/..." that is provided by Git in these subcommands. The test
therefore has a prerequisite that we are not on Windows. The cross-
platform logic still allows us to test the macOS logic on a Linux
machine.

We can verify the commands that were run by 'git maintenance start'
and 'git maintenance stop' by injecting a script that writes the
command-line arguments into GIT_TEST_MAINT_SCHEDULER.

An earlier version of this patch accidentally had an opening
"<dict>" tag when it should have had a closing "</dict>" tag. This
was caught during manual testing with actual 'launchctl' commands,
but we do not want to update developers' tasks when running tests.
It appears that macOS includes the "xmllint" tool which can verify
the XML format. This is useful for any system that might contain
the tool, so use it whenever it is available.

We strive to make these tests work on all platforms, but Windows caused
some headaches. In particular, the value of getuid() called by the C
code is not guaranteed to be the same as `$(id -u)` invoked by a test.
This is because `git.exe` is a native Windows program, whereas the
utility programs run by the test script mostly utilize the MSYS2 runtime,
which emulates a POSIX-like environment. Since the purpose of the test
is to check that the input to the hook is well-formed, the actual user
ID is immaterial, thus we can work around the problem by making the the
test UID-agnostic. Another subtle issue is the $HOME environment
variable being a Windows-style path instead of a Unix-style path. We can
be more flexible here instead of expecting exact path matches.

Helped-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Co-authored-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocompletion: add proper public __git_complete
Felipe Contreras [Wed, 30 Dec 2020 23:29:50 +0000 (17:29 -0600)] 
completion: add proper public __git_complete

When __git_complete was introduced, it was meant to be temporarily, while
a proper guideline for public shell functions was established
(tentatively _GIT_complete), but since that never happened, people
in the wild started to use __git_complete, even though it was marked as
not public.

Eight years is more than enough wait, let's mark this function as
public, and make it a bit more user-friendly.

So that instead of doing:

  __git_complete gk __gitk_main

The user can do:

  __git_complete gk gitk

And instead of:

  __git_complete gf _git_fetch

Do:

  __git_complete gf git_fetch

Backwards compatibility is maintained.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agotest: completion: add tests for __git_complete
Felipe Contreras [Wed, 30 Dec 2020 23:29:49 +0000 (17:29 -0600)] 
test: completion: add tests for __git_complete

Even though the function was marked as not public, it's already used in
the wild.

We should at least test basic functionality.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocompletion: bash: improve function detection
Felipe Contreras [Wed, 30 Dec 2020 23:29:48 +0000 (17:29 -0600)] 
completion: bash: improve function detection

 1. We should quote the argument
 2. We don't need two redirections
 3. A safeguard for arguments (-a) would be good

Suggested-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocompletion: bash: add __git_have_func helper
Felipe Contreras [Wed, 30 Dec 2020 23:29:47 +0000 (17:29 -0600)] 
completion: bash: add __git_have_func helper

This makes the code more readable, and also will help when new code
wants to do similar checks.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agorebase: verify commit parameter
René Scharfe [Thu, 31 Dec 2020 23:55:12 +0000 (00:55 +0100)] 
rebase: verify commit parameter

If the user specifies a base commit to switch to, check if it actually
references a commit right away to avoid getting confused later on when
it turns out to be an invalid object.

Reported-by: LeSeulArtichaut <leseulartichaut@gmail.com>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agorevision: trace topo-walk statistics
Derrick Stolee [Wed, 30 Dec 2020 04:31:53 +0000 (04:31 +0000)] 
revision: trace topo-walk statistics

We trace statistics about the effectiveness of changed-path Bloom
filters since 42e50e78 (revision.c: add trace2 stats around Bloom
filter usage, 2020-04-06). Add similar tracing for the topo-walk
algorithm that uses generation numbers to limit the walk size.

This information can help investigate and describe benefits to
heuristics and other changes.

The information that is printed is in JSON format and can be formatted
nicely to present as follows:

    {
"count_explort_walked":2603,
"count_indegree_walked":2603,
"count_topo_walked":473
    }

Each of these values count the number of commits are visited by each of
the three "stages" of the topo-walk as detailed in b4542418 (revision.c:
generation-based topo-order algorithm, 2018-11-01).

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agohash-lookup: rename from sha1-lookup
Martin Ågren [Thu, 31 Dec 2020 11:56:23 +0000 (12:56 +0100)] 
hash-lookup: rename from sha1-lookup

Change all remnants of "sha1" in hash-lookup.c and .h and rename them to
reflect that we're not just able to handle SHA-1 these days.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agosha1-lookup: rename `sha1_pos()` as `hash_pos()`
Martin Ågren [Thu, 31 Dec 2020 11:56:22 +0000 (12:56 +0100)] 
sha1-lookup: rename `sha1_pos()` as `hash_pos()`

Rename this function to reflect that we're not just able to handle SHA-1
these days. There are a few instances of "sha1" left in sha1-lookup.[ch]
after this, but those will be addressed in the next commit.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoobject-file.c: rename from sha1-file.c
Martin Ågren [Thu, 31 Dec 2020 11:56:21 +0000 (12:56 +0100)] 
object-file.c: rename from sha1-file.c

Drop the last remnant of "sha1" in this file and rename it to reflect
that we're not just able to handle SHA-1 these days.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoobject-name.c: rename from sha1-name.c
Martin Ågren [Thu, 31 Dec 2020 11:56:20 +0000 (12:56 +0100)] 
object-name.c: rename from sha1-name.c

Generalize the last remnants of "sha" and "sha1" in this file and rename
it to reflect that we're not just able to handle SHA-1 these days.

We need to update one test to check for an updated error string.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agopack-format.txt: document sizes at start of delta data
Martin Ågren [Tue, 29 Dec 2020 22:43:35 +0000 (23:43 +0100)] 
pack-format.txt: document sizes at start of delta data

We document the delta data as a set of instructions, but forget to
document the two sizes that precede those instructions: the size of the
base object and the size of the object to be reconstructed. Fix this
omission.

Rather than cramming all the details about the encoding into the running
text, introduce a separate section detailing our "size encoding" and
refer to it.

Reported-by: Ross Light <ross@zombiezen.com>
Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot6016: move to lib-log-graph.sh framework
Antonio Russo [Mon, 4 Jan 2021 02:30:35 +0000 (19:30 -0700)] 
t6016: move to lib-log-graph.sh framework

t6016 manually reconstructs git log --graph output by using the reported
commit hashes from `git rev-parse`.  Each tag is converted into an
environment variable manually, and then `echo`-ed to an expected output
file, which is in turn compared to the actual output.

The expected output is difficult to read and write, because, e.g.,
each line of output must be prefaced with echo, quoted, and properly
escaped.  Additionally, the test is sensitive to trailing whitespace,
which may potentially be removed from graph log output in the future.

In order to reduce duplication, ease troubleshooting of failed tests by
improving readability, and ease the addition of more tests to this file,
port the operations to `lib-log-graph.sh`, which is already used in
several other tests, e.g., t4215.  Give all merges a simple commit
message, and use a common `check_graph` macro taking a heredoc of the
expected output which does not required extensive escaping.

Signed-off-by: Antonio Russo <aerusso@aerusso.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot1300: don't needlessly work with `core.foo` configs
Martin Ågren [Sun, 3 Jan 2021 09:36:48 +0000 (10:36 +0100)] 
t1300: don't needlessly work with `core.foo` configs

We use various made-up config keys in the "core" section for no real
reason. Change them to work in the "section" section instead and be
careful to also change "cores" to "sections". Make sure to also catch
"Core", "CoReS" and similar.

There are a few instances that actually want to work with a real "core"
config such as `core.bare` or `core.editor`. After this, it's clearer
that they work with "core" for a reason.

Reported-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot1300: remove duplicate test for `--file no-such-file`
Martin Ågren [Sun, 3 Jan 2021 09:36:47 +0000 (10:36 +0100)] 
t1300: remove duplicate test for `--file no-such-file`

We test that we can handle `git config --file symlink` and the error
case of `git config --file symlink-to-missing-file`. For good measure,
we also throw in a test to check that we correctly handle referencing a
missing regular file. But we have such a test earlier in this script.
They both check that we fail to use `--file no-such-file --list`.

Drop the latter of these and keep the one that is in the general area
where we test `--file` and `GIT_CONFIG`. The one we're dropping also
checks that we can't even get a specific key from the missing file --
let's make sure we check that in the test we keep.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot1300: remove duplicate test for `--file ../foo`
Martin Ågren [Sun, 3 Jan 2021 09:36:46 +0000 (10:36 +0100)] 
t1300: remove duplicate test for `--file ../foo`

We have two tests for checking that we can handle `git config --file
../other-config ...`. One, using `--file`, was introduced in 65807ee697
("builtin-config: Fix crash when using "-f <relative path>" from
non-root dir", 2010-01-26), then another, using `GIT_CONFIG`, came about
in 270a34438b ("config: stop using config_exclusive_filename",
2012-02-16).

The latter of these was then converted to use `--file` in f7e8714101
("t: prefer "git config --file" to GIT_CONFIG", 2014-03-20). Both where
then simplified in a5db0b77b9 ("t1300: extract and use
test_cmp_config()", 2018-10-21).

These two tests differ slightly in the order of the options used, but
other than that, they are identical. Let's drop one. As noted in
f7e8714101, we do still have a test for `GIT_CONFIG` and it shares the
implementation with `--file`.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogitmodules.txt: fix 'GIT_WORK_TREE' variable name
Philippe Blain [Sun, 3 Jan 2021 17:42:15 +0000 (17:42 +0000)] 
gitmodules.txt: fix 'GIT_WORK_TREE' variable name

'gitmodules.txt' is a guide about the '.gitmodules' file that describes
submodule properties, and that file must exist at the root of the
repository. This was clarified in e5b5c1d2cf (Document clarification:
gitmodules, gitattributes, 2008-08-31).

However, that commit mistakenly uses the non-existing environment
variable 'GIT_WORK_DIR' to refer to the root of the repository.

Fix that by using the correct variable, 'GIT_WORK_TREE'. Take the
opportunity to modernize and improve the formatting of that guide,
and fix a grammar mistake.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Acked-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agodoc: fix some typos
Thomas Ackermann [Sun, 3 Jan 2021 14:25:50 +0000 (14:25 +0000)] 
doc: fix some typos

Signed-off-by: Thomas Ackermann <th.acker@arcor.de>
Acked-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoGit 2.30 v2.30.0
Junio C Hamano [Sun, 27 Dec 2020 23:15:23 +0000 (15:15 -0800)] 
Git 2.30

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'pb/doc-git-linkit-fix'
Junio C Hamano [Sun, 27 Dec 2020 23:14:31 +0000 (15:14 -0800)] 
Merge branch 'pb/doc-git-linkit-fix'

Docfix.

* pb/doc-git-linkit-fix:
  git.txt: fix typos in 'linkgit' macro invocation

3 years agoMerge tag 'l10n-2.30.0-rnd2' of https://github.com/git-l10n/git-po
Junio C Hamano [Sun, 27 Dec 2020 23:01:16 +0000 (15:01 -0800)] 
Merge tag 'l10n-2.30.0-rnd2' of https://github.com/git-l10n/git-po

l10n for Git 2.30.0 round 2

* tag 'l10n-2.30.0-rnd2' of https://github.com/git-l10n/git-po:
  l10n: zh_CN: for git v2.30.0 l10n round 1 and 2
  l10n: zh_TW.po: v2.30.0 round 2 (1 untranslated)
  l10n: pl.po: add translation and set team leader
  l10n: pl.po: started Polish translation
  l10n: de.po: Update German translation for Git 2.30.0
  l10n: Update Catalan translation
  l10n: bg.po: Updated Bulgarian translation (5037t)
  l10n: fr.po v2.30.0 rnd 2
  l10n: tr: v2.30.0-r2
  l10n: sv.po: Update Swedish translation (5037t0f0u)
  l10n: vi.po(5037t): v2.30.0 rnd 2
  l10n: git.pot: v2.30.0 round 2 (1 new, 2 removed)
  l10n: Update Catalan translation
  l10n: fr.po: v2.30.0 rnd 1
  l10n: fr.po Fix a typo
  l10n: fr fix misleading message
  l10n: tr: v2.30.0-r1
  l10n: sv.po: Update Swedish translation (5038t0f0u)
  l10n: git.pot: v2.30.0 round 1 (70 new, 45 removed)

3 years agol10n: zh_CN: for git v2.30.0 l10n round 1 and 2
Jiang Xin [Mon, 7 Dec 2020 00:10:10 +0000 (08:10 +0800)] 
l10n: zh_CN: for git v2.30.0 l10n round 1 and 2

Translate 71 new messages (5037t0f0u) for git 2.30.0.

Reviewed-by: 依云 <lilydjwg@gmail.com>
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
3 years agoMerge branch 'l10n/zh_TW/201223' of github.com:l10n-tw/git-po
Jiang Xin [Fri, 25 Dec 2020 07:12:02 +0000 (15:12 +0800)] 
Merge branch 'l10n/zh_TW/201223' of github.com:l10n-tw/git-po

* 'l10n/zh_TW/201223' of github.com:l10n-tw/git-po:
  l10n: zh_TW.po: v2.30.0 round 2 (1 untranslated)

3 years agol10n: zh_TW.po: v2.30.0 round 2 (1 untranslated)
pan93412 [Wed, 23 Dec 2020 13:52:18 +0000 (21:52 +0800)] 
l10n: zh_TW.po: v2.30.0 round 2 (1 untranslated)

Signed-off-by: pan93412 <pan93412@gmail.com>
3 years agol10n: pl.po: add translation and set team leader
Arusekk [Wed, 2 Dec 2020 23:19:58 +0000 (00:19 +0100)] 
l10n: pl.po: add translation and set team leader

Signed-off-by: Arusekk <arek_koz@o2.pl>
3 years agoGit 2.30-rc2 v2.30.0-rc2
Junio C Hamano [Wed, 23 Dec 2020 21:57:41 +0000 (13:57 -0800)] 
Git 2.30-rc2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'nk/refspecs-negative-fix'
Junio C Hamano [Wed, 23 Dec 2020 21:59:46 +0000 (13:59 -0800)] 
Merge branch 'nk/refspecs-negative-fix'

Hotfix for recent regression.

* nk/refspecs-negative-fix:
  negative-refspec: improve comment on query_matches_negative_refspec
  negative-refspec: fix segfault on : refspec

3 years agoMerge branch 'ma/maintenance-crontab-fix'
Junio C Hamano [Wed, 23 Dec 2020 21:59:46 +0000 (13:59 -0800)] 
Merge branch 'ma/maintenance-crontab-fix'

Hotfix for a topic of this cycle.

* ma/maintenance-crontab-fix:
  t7900-maintenance: test for magic markers
  gc: fix handling of crontab magic markers
  git-maintenance.txt: add missing word

3 years agoMerge branch 'dl/checkout-p-merge-base'
Junio C Hamano [Wed, 23 Dec 2020 21:59:46 +0000 (13:59 -0800)] 
Merge branch 'dl/checkout-p-merge-base'

Fix to a regression introduced during this cycle.

* dl/checkout-p-merge-base:
  checkout -p: handle tree arguments correctly again

3 years agoMerge branch 'js/no-more-prepare-for-main-in-test'
Junio C Hamano [Wed, 23 Dec 2020 21:59:46 +0000 (13:59 -0800)] 
Merge branch 'js/no-more-prepare-for-main-in-test'

Test coverage fix.

* js/no-more-prepare-for-main-in-test:
  tests: drop the `PREPARE_FOR_MAIN_BRANCH` prereq
  t9902: use `main` as initial branch name
  t6302: use `main` as initial branch name
  t5703: use `main` as initial branch name
  t5510: use `main` as initial branch name
  t5505: finalize transitioning to using the branch name `main`
  t3205: finalize transitioning to using the branch name `main`
  t3203: complete the transition to using the branch name `main`
  t3201: finalize transitioning to using the branch name `main`
  t3200: finish transitioning to the initial branch name `main`
  t1400: use `main` as initial branch name

3 years agoMerge branch 'jx/pack-redundant-on-single-pack'
Junio C Hamano [Wed, 23 Dec 2020 21:59:46 +0000 (13:59 -0800)] 
Merge branch 'jx/pack-redundant-on-single-pack'

"git pack-redandant" when there is only one packfile used to crash,
which has been corrected.

* jx/pack-redundant-on-single-pack:
  pack-redundant: fix crash when one packfile in repo

3 years agol10n: pl.po: started Polish translation
m4sk1n [Mon, 16 Jan 2017 19:31:10 +0000 (20:31 +0100)] 
l10n: pl.po: started Polish translation

Signed-off-by: Arusekk <arek_koz@o2.pl>
3 years agogit-p4: fix syncing file types with pattern
Daniel Levin [Wed, 23 Dec 2020 14:37:27 +0000 (14:37 +0000)] 
git-p4: fix syncing file types with pattern

Example of pattern file type: text+k

Text filtered through the p4 pattern regexp must be converted from
string back to bytes, otherwise 'data' command for the fast-import
will receive extra invalid characters, followed by the fast-import
process error.

CC: Yang Zhao <yang.zhao@skyboxlabs.com>
Signed-off-by: Daniel Levin <dendy.ua@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>