]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
2 years agoMerge branch 'da/rhel7-lacks-uncompress2-and-c99'
Junio C Hamano [Mon, 17 Jan 2022 23:15:59 +0000 (15:15 -0800)] 
Merge branch 'da/rhel7-lacks-uncompress2-and-c99'

Adjust build on RHEL 7 to explicitly ask C99 support and use
the fallback implementation of uncompress2 we ship.

* da/rhel7-lacks-uncompress2-and-c99:
  build: centos/RHEL 7 ships with an older gcc and zlib

2 years agobuild: centos/RHEL 7 ships with an older gcc and zlib
David Aguilar [Sun, 16 Jan 2022 02:05:20 +0000 (18:05 -0800)] 
build: centos/RHEL 7 ships with an older gcc and zlib

GCC 4.8.5 is the default system compiler on centos7/RHEL7.
This version requires -std=c99 to enable c99 support.

zlib 1.2.7 on centos7/rhel7 lacks uncompress2().

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoGit 2.35-rc1 v2.35.0-rc1
Junio C Hamano [Fri, 14 Jan 2022 23:26:53 +0000 (15:26 -0800)] 
Git 2.35-rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'js/t1450-making-it-writable-does-not-need-full-posixperm'
Junio C Hamano [Fri, 14 Jan 2022 23:25:15 +0000 (15:25 -0800)] 
Merge branch 'js/t1450-making-it-writable-does-not-need-full-posixperm'

Test fix.

* js/t1450-making-it-writable-does-not-need-full-posixperm:
  t1450-fsck: exec-bit is not needed to make loose object writable

2 years agoMerge branch 'ab/reftable-build-fixes'
Junio C Hamano [Fri, 14 Jan 2022 23:25:15 +0000 (15:25 -0800)] 
Merge branch 'ab/reftable-build-fixes'

A few portability tweaks.

* ab/reftable-build-fixes:
  reftable tests: avoid "int" overflow, use "uint64_t"
  reftable: avoid initializing structs from structs

2 years agoMerge branch 'ab/refs-errno-cleanup'
Junio C Hamano [Fri, 14 Jan 2022 23:25:14 +0000 (15:25 -0800)] 
Merge branch 'ab/refs-errno-cleanup'

A brown-paper-bag fix on top of a topic that was merged during this
cycle.

* ab/refs-errno-cleanup:
  refs API: use "failure_errno", not "errno"

2 years agoreftable tests: avoid "int" overflow, use "uint64_t"
Ævar Arnfjörð Bjarmason [Tue, 11 Jan 2022 16:40:23 +0000 (17:40 +0100)] 
reftable tests: avoid "int" overflow, use "uint64_t"

Change code added in 1ae2b8cda84 (reftable: add merged table view,
2021-10-07) to consistently use the "uint64_t" type. These "min" and
"max" variables get passed in the body of this function to a function
whose prototype is:

    [...] reftable_writer_set_limits([...], uint64_t min, uint64_t max

This avoids the following warning on SunCC 12.5 on
gcc211.fsffrance.org:

    "reftable/merged_test.c", line 27: warning: initializer does not fit or is out of range: 0xffffffff

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoreftable: avoid initializing structs from structs
Han-Wen Nienhuys [Thu, 13 Jan 2022 16:55:34 +0000 (16:55 +0000)] 
reftable: avoid initializing structs from structs

Apparently, the IBM xlc compiler doesn't like this.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot1450-fsck: exec-bit is not needed to make loose object writable
Johannes Sixt [Thu, 13 Jan 2022 20:28:45 +0000 (21:28 +0100)] 
t1450-fsck: exec-bit is not needed to make loose object writable

A test case wants to append stuff to a loose object file to ensure
that this kind of corruption is detected. To make a read-only loose
object file writable with chmod, it is not necessary to also make
it executable. Replace the bitmask 755 with the instruction +w to
request only the write bit and to also heed the umask. And get rid
of a POSIXPERM prerequisite, which is unnecessary for the test.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agorefs API: use "failure_errno", not "errno"
Ævar Arnfjörð Bjarmason [Wed, 12 Jan 2022 12:36:46 +0000 (13:36 +0100)] 
refs API: use "failure_errno", not "errno"

Fix a logic error in refs_resolve_ref_unsafe() introduced in a recent
series of mine to abstract the refs API away from errno. See
96f6623ada0 (Merge branch 'ab/refs-errno-cleanup', 2021-11-29)for that
series.

In that series introduction of "failure_errno" to
refs_resolve_ref_unsafe came in ef18119dec8 (refs API: add a version
of refs_resolve_ref_unsafe() with "errno", 2021-10-16). There we'd set
"errno = 0" immediately before refs_read_raw_ref(), and then set
"failure_errno" to "errno" if errno was non-zero afterwards.

Then in the next commit 8b72fea7e91 (refs API: make
refs_read_raw_ref() not set errno, 2021-10-16) we started expecting
"refs_read_raw_ref()" to set "failure_errno". It would do that if
refs_read_raw_ref() failed, but it wouldn't be the same errno.

So we might set the "errno" here to any arbitrary bad value, and end
up e.g. returning NULL when we meant to return the refname from
refs_resolve_ref_unsafe(), or the other way around. Instrumenting this
code will reveal cases where refs_read_raw_ref() will fail, and
"errno" and "failure_errno" will be set to different values.

In practice I haven't found a case where this scary bug changed
anything in practice. The reason for that is that we'll not care about
the actual value of "errno" here per-se, but only whether:

 1. We have an errno
 2. If it's one of ENOENT, EISDIR or ENOTDIR. See the adjacent code
    added in a1c1d8170db (refs_resolve_ref_unsafe: handle d/f
    conflicts for writes, 2017-10-06)

I.e. if we clobber "failure_errno" with "errno", but it happened to be
one of those three, and we'll clobber it with another one of the three
we were OK.

Perhaps there are cases where the difference ended up mattering, but I
haven't found them. Instrumenting the test suite to fail if "errno"
and "failure_errno" are different shows a lot of failures, checking if
they're different *and* one is but not the other is outside that list
of three "errno" values yields no failures.

But let's fix the obvious bug. We should just stop paying attention to
"errno" in refs_resolve_ref_unsafe(). In addition let's change the
partial resetting of "errno" in files_read_raw_ref() to happen just
before the "return", to ensure that any such bug will be more easily
spotted in the future.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoLast minute fixes before -rc1
Junio C Hamano [Thu, 13 Jan 2022 00:27:08 +0000 (16:27 -0800)] 
Last minute fixes before -rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'ps/lockfile-cleanup-fix'
Junio C Hamano [Wed, 12 Jan 2022 23:11:43 +0000 (15:11 -0800)] 
Merge branch 'ps/lockfile-cleanup-fix'

Some lockfile code called free() in signal-death code path, which
has been corrected.

* ps/lockfile-cleanup-fix:
  fetch: fix deadlock when cleaning up lockfiles in async signals

2 years agoMerge branch 'ma/header-dup-cleanup'
Junio C Hamano [Wed, 12 Jan 2022 23:11:43 +0000 (15:11 -0800)] 
Merge branch 'ma/header-dup-cleanup'

Code clean-up.

* ma/header-dup-cleanup:
  cache.h: drop duplicate `ensure_full_index()` declaration

2 years agoMerge branch 'fs/gpg-unknown-key-test-fix'
Junio C Hamano [Wed, 12 Jan 2022 23:11:42 +0000 (15:11 -0800)] 
Merge branch 'fs/gpg-unknown-key-test-fix'

Test simplification.

* fs/gpg-unknown-key-test-fix:
  t/gpg: simplify test for unknown key

2 years agoMerge branch 'ak/protect-any-current-branch'
Junio C Hamano [Wed, 12 Jan 2022 23:11:41 +0000 (15:11 -0800)] 
Merge branch 'ak/protect-any-current-branch'

* ak/protect-any-current-branch:
  branch: missing space fix at line 313

2 years agoMerge branch 'jt/pack-header-lshift-overflow'
Junio C Hamano [Wed, 12 Jan 2022 23:11:41 +0000 (15:11 -0800)] 
Merge branch 'jt/pack-header-lshift-overflow'

* jt/pack-header-lshift-overflow:
  packfile: fix off-by-one error in decoding logic

2 years agoMerge branch 'rb/nonstop-lacks-uncompress2'
Junio C Hamano [Wed, 12 Jan 2022 23:11:41 +0000 (15:11 -0800)] 
Merge branch 'rb/nonstop-lacks-uncompress2'

* rb/nonstop-lacks-uncompress2:
  build: NonStop ships with an older zlib

2 years agoMerge branch 'ma/windows-dynload-fix'
Junio C Hamano [Wed, 12 Jan 2022 23:11:41 +0000 (15:11 -0800)] 
Merge branch 'ma/windows-dynload-fix'

Fix calling dynamically loaded functions on Windows.

* ma/windows-dynload-fix:
  lazyload: use correct calling conventions

2 years agoMerge branch 'fs/ssh-signing-key-lifetime'
Junio C Hamano [Wed, 12 Jan 2022 23:11:41 +0000 (15:11 -0800)] 
Merge branch 'fs/ssh-signing-key-lifetime'

"git merge $signed_tag" started to drop the tag message from the
default merge message it uses by accident, which has been corrected.

* fs/ssh-signing-key-lifetime:
  fmt-merge-msg: prevent use-after-free with signed tags

2 years agobuild: NonStop ships with an older zlib
Randall S. Becker [Tue, 11 Jan 2022 03:51:39 +0000 (22:51 -0500)] 
build: NonStop ships with an older zlib

Notably, it lacks uncompress2(); use the fallback we ship in our
tree instead.

Signed-off-by: Randall S. Becker <rsbecker@nexbridge.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agopackfile: fix off-by-one error in decoding logic
Junio C Hamano [Wed, 12 Jan 2022 20:11:42 +0000 (12:11 -0800)] 
packfile: fix off-by-one error in decoding logic

shift count being exactly at 7-bit smaller than the long is OK; on
32-bit architecture, shift count starts at 4 and goes through 11, 18
and 25, at which point the guard triggers one iteration too early.

Reported-by: Marc Strapetz <marc.strapetz@syntevo.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot/gpg: simplify test for unknown key
Fabian Stelzer [Wed, 12 Jan 2022 12:07:57 +0000 (13:07 +0100)] 
t/gpg: simplify test for unknown key

To test for a key that is completely unknown to the keyring we need one
to sign the commit with. This was done by generating a new key and not
add it into the keyring. To avoid the key generation overhead and
problems where GPG did hang in CI during it, switch GNUPGHOME to the
empty $GNUPGHOME_NOT_USED instead, therefore making all used keys unknown
for this single `verify-commit` call.

Reported-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Fabian Stelzer <fs@gigacodes.de>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agobranch: missing space fix at line 313
Bagas Sanjaya [Tue, 11 Jan 2022 12:36:27 +0000 (19:36 +0700)] 
branch: missing space fix at line 313

The message introduced by commit 593a2a5d06 (branch: protect branches
checked out in all worktrees, 2021-12-01) is missing a space in the
first line, add it.

Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofmt-merge-msg: prevent use-after-free with signed tags
Taylor Blau [Mon, 10 Jan 2022 21:19:06 +0000 (16:19 -0500)] 
fmt-merge-msg: prevent use-after-free with signed tags

When merging a signed tag, fmt_merge_msg_sigs() is responsible for
populating the body of the merge message with the names of the signed
tags, their signatures, and the validity of those signatures.

In 02769437e1 (ssh signing: use sigc struct to pass payload,
2021-12-09), check_signature() was taught to pass the object payload via
the sigc struct instead of passing the payload buffer separately.

In effect, 02769437e1 causes buf, and sigc.payload to point at the same
region in memory. This causes a problem for fmt_tag_signature(), which
wants to read from this location, since it is freed beforehand by
signature_check_clear() (which frees it via sigc's `payload` member).

That makes the subsequent use in fmt_tag_signature() a use-after-free.

As a result, merge messages did not contain the body of any signed tags.
Luckily, they tend not to contain garbage, either, since the result of
strstr()-ing the object buffer in fmt_tag_signature() is guarded:

    const char *tag_body = strstr(buf, "\n\n");
    if (tag_body) {
      tag_body += 2;
      strbuf_add(tagbuf, tag_body, buf + len - tag_body);
    }

Unfortunately, the tests in t6200 did not catch this at the time because
they do not search for the body of signed tags in fmt-merge-msg's
output.

Resolve this by waiting to call signature_check_clear() until after its
contents can be safely discarded. Harden ourselves against any future
regressions in this area by making sure we can find signed tag messages
in the output of fmt-merge-msg, too.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoGit 2.35-rc0 v2.35.0-rc0
Junio C Hamano [Mon, 10 Jan 2022 19:28:51 +0000 (11:28 -0800)] 
Git 2.35-rc0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'en/stash-df-fix'
Junio C Hamano [Mon, 10 Jan 2022 19:52:57 +0000 (11:52 -0800)] 
Merge branch 'en/stash-df-fix'

"git stash apply" forgot to attempt restoring untracked files when
it failed to restore changes to tracked ones.

* en/stash-df-fix:
  stash: do not return before restoring untracked files

2 years agoMerge branch 'ms/t-readme-typofix'
Junio C Hamano [Mon, 10 Jan 2022 19:52:56 +0000 (11:52 -0800)] 
Merge branch 'ms/t-readme-typofix'

Typofix.

* ms/t-readme-typofix:
  t/README: fix typo

2 years agoMerge branch 'ja/i18n-similar-messages'
Junio C Hamano [Mon, 10 Jan 2022 19:52:56 +0000 (11:52 -0800)] 
Merge branch 'ja/i18n-similar-messages'

Similar message templates have been consolidated so that
translators need to work on fewer number of messages.

* ja/i18n-similar-messages:
  i18n: turn even more messages into "cannot be used together" ones
  i18n: ref-filter: factorize "%(foo) atom used without %(bar) atom"
  i18n: factorize "--foo outside a repository"
  i18n: refactor "unrecognized %(foo) argument" strings
  i18n: factorize "no directory given for --foo"
  i18n: factorize "--foo requires --bar" and the like
  i18n: tag.c factorize i18n strings
  i18n: standardize "cannot open" and "cannot read"
  i18n: turn "options are incompatible" into "cannot be used together"
  i18n: refactor "%s, %s and %s are mutually exclusive"
  i18n: refactor "foo and bar are mutually exclusive"

2 years agoMerge branch 'en/merge-ort-renorm-with-rename-delete-conflict-fix'
Junio C Hamano [Mon, 10 Jan 2022 19:52:55 +0000 (11:52 -0800)] 
Merge branch 'en/merge-ort-renorm-with-rename-delete-conflict-fix'

A corner case bug in the ort merge strategy has been corrected.

* en/merge-ort-renorm-with-rename-delete-conflict-fix:
  merge-ort: fix bug with renormalization and rename/delete conflicts

2 years agoMerge branch 'jc/doc-submitting-patches-choice-of-base'
Junio C Hamano [Mon, 10 Jan 2022 19:52:55 +0000 (11:52 -0800)] 
Merge branch 'jc/doc-submitting-patches-choice-of-base'

Extend the guidance to choose the base commit to build your work
on, and hint/nudge contributors to read others' changes.

* jc/doc-submitting-patches-choice-of-base:
  SubmittingPatchs: clarify choice of base and testing

2 years agoMerge branch 'jl/subtree-check-parents-argument-passing-fix'
Junio C Hamano [Mon, 10 Jan 2022 19:52:54 +0000 (11:52 -0800)] 
Merge branch 'jl/subtree-check-parents-argument-passing-fix'

Fix performance-releated bug in "git subtree" (in contrib/).

* jl/subtree-check-parents-argument-passing-fix:
  subtree: fix argument handling in check_parents

2 years agoMerge branch 'lh/use-gnu-color-in-grep'
Junio C Hamano [Mon, 10 Jan 2022 19:52:54 +0000 (11:52 -0800)] 
Merge branch 'lh/use-gnu-color-in-grep'

The color palette used by "git grep" has been updated to match that
of GNU grep.

* lh/use-gnu-color-in-grep:
  grep: align default colors with GNU grep ones

2 years agoMerge branch 'js/branch-track-inherit'
Junio C Hamano [Mon, 10 Jan 2022 19:52:54 +0000 (11:52 -0800)] 
Merge branch 'js/branch-track-inherit'

"git -c branch.autosetupmerge=inherit branch new old" makes "new"
to have the same upstream as the "old" branch, instead of marking
"old" itself as its upstream.

* js/branch-track-inherit:
  config: require lowercase for branch.*.autosetupmerge
  branch: add flags and config to inherit tracking
  branch: accept multiple upstream branches for tracking

2 years agoMerge branch 'ab/usage-die-message'
Junio C Hamano [Mon, 10 Jan 2022 19:52:53 +0000 (11:52 -0800)] 
Merge branch 'ab/usage-die-message'

Code clean-up to hide vreportf() from public API.

* 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 agoMerge branch 'jz/apply-3-corner-cases'
Junio C Hamano [Mon, 10 Jan 2022 19:52:53 +0000 (11:52 -0800)] 
Merge branch 'jz/apply-3-corner-cases'

"git apply --3way" bypasses the attempt to do a three-way
application in more cases to address the regression caused by the
recent change to use direct application as a fallback.

* jz/apply-3-corner-cases:
  git-apply: skip threeway in add / rename cases

2 years agoMerge branch 'hn/reftable-fixes'
Junio C Hamano [Mon, 10 Jan 2022 19:52:52 +0000 (11:52 -0800)] 
Merge branch 'hn/reftable-fixes'

Assorted fixlets in reftable code.

* hn/reftable-fixes:
  reftable: support preset file mode for writing
  reftable: signal overflow
  reftable: fix typo in header

2 years agoMerge branch 'ab/reflog-prep'
Junio C Hamano [Mon, 10 Jan 2022 19:52:52 +0000 (11:52 -0800)] 
Merge branch 'ab/reflog-prep'

Code refactoring in the reflog part of refs API.

* ab/reflog-prep:
  reflog + refs-backend: move "verbose" out of the backend
  refs files-backend: assume cb->newlog if !EXPIRE_REFLOGS_DRY_RUN
  reflog: reduce scope of "struct rev_info"
  reflog expire: don't use lookup_commit_reference_gently()
  reflog expire: refactor & use "tip_commit" only for UE_NORMAL
  reflog expire: use "switch" over enum values
  reflog: change one->many worktree->refnames to use a string_list
  reflog expire: narrow scope of "cb" in cmd_reflog_expire()
  reflog delete: narrow scope of "cmd" passed to count_reflog_ent()

2 years agoMerge branch 'ab/do-not-limit-stash-help-to-push'
Junio C Hamano [Mon, 10 Jan 2022 19:52:52 +0000 (11:52 -0800)] 
Merge branch 'ab/do-not-limit-stash-help-to-push'

"git stash" by default triggers its "push" action, but its
implementation also made "git stash -h" to show short help only for
"git stash push", which has been corrected.

* ab/do-not-limit-stash-help-to-push:
  stash: don't show "git stash push" usage on bad "git stash" usage

2 years agoMerge branch 'ab/makefile-hook-list-dependency-fix'
Junio C Hamano [Mon, 10 Jan 2022 19:52:52 +0000 (11:52 -0800)] 
Merge branch 'ab/makefile-hook-list-dependency-fix'

Fix dependency rules to generate hook-list.h header file.

* ab/makefile-hook-list-dependency-fix:
  Makefile: correct the dependency graph of hook-list.h

2 years agoMerge branch 'ab/makefile-pager-env-is-used-only-by-pager.c'
Junio C Hamano [Mon, 10 Jan 2022 19:52:51 +0000 (11:52 -0800)] 
Merge branch 'ab/makefile-pager-env-is-used-only-by-pager.c'

* ab/makefile-pager-env-is-used-only-by-pager.c:
  Makefile: move -DPAGER_ENV from BASIC_CFLAGS to EXTRA_CPPFLAGS

2 years agoMerge branch 'ab/makefile-msgfmt-wo-stats'
Junio C Hamano [Mon, 10 Jan 2022 19:52:51 +0000 (11:52 -0800)] 
Merge branch 'ab/makefile-msgfmt-wo-stats'

Make the recipe that runs msgfmt less noisy.

* ab/makefile-msgfmt-wo-stats:
  Makefile: don't invoke msgfmt with --statistics

2 years agoMerge branch 'hn/refs-debug-update'
Junio C Hamano [Mon, 10 Jan 2022 19:52:51 +0000 (11:52 -0800)] 
Merge branch 'hn/refs-debug-update'

Debugging support for refs API.

* hn/refs-debug-update:
  refs: centralize initialization of the base ref_store.
  refs: print error message in debug output
  refs: pass gitdir to packed_ref_store_create

2 years agoMerge branch 'ds/fetch-pull-with-sparse-index'
Junio C Hamano [Mon, 10 Jan 2022 19:52:50 +0000 (11:52 -0800)] 
Merge branch 'ds/fetch-pull-with-sparse-index'

"git fetch" and "git pull" are now declared sparse-index clean.
Also "git ls-files" learns the "--sparse" option to help debugging.

* ds/fetch-pull-with-sparse-index:
  test-read-cache: remove --table, --expand options
  t1091/t3705: remove 'test-tool read-cache --table'
  t1092: replace 'read-cache --table' with 'ls-files --sparse'
  ls-files: add --sparse option
  fetch/pull: use the sparse index

2 years agoMerge branch 'hn/ref-api-tests-update'
Junio C Hamano [Mon, 10 Jan 2022 19:52:50 +0000 (11:52 -0800)] 
Merge branch 'hn/ref-api-tests-update'

Test updates.

* hn/ref-api-tests-update:
  t7004: use "test-tool ref-store" for reflog inspection
  t7004: create separate tags for different tests
  t5550: require REFFILES
  t5540: require REFFILES

2 years agoMerge branch 'jh/p4-remove-unused'
Junio C Hamano [Mon, 10 Jan 2022 19:52:50 +0000 (11:52 -0800)] 
Merge branch 'jh/p4-remove-unused'

Remove a few commands from "git p4" that aren't very useful.

* jh/p4-remove-unused:
  git-p4: remove "rollback" verb
  git-p4: remove "debug" verb

2 years agoMerge branch 'ja/perf-use-specified-shell'
Junio C Hamano [Mon, 10 Jan 2022 19:52:50 +0000 (11:52 -0800)] 
Merge branch 'ja/perf-use-specified-shell'

Perf tests were run with end-user's shell, but it has been
corrected to use the shell specified by $TEST_SHELL_PATH.

* ja/perf-use-specified-shell:
  t/perf: do not run tests in user's $SHELL

2 years agoMerge branch 'hn/test-ref-store-show-hash-algo'
Junio C Hamano [Mon, 10 Jan 2022 19:52:50 +0000 (11:52 -0800)] 
Merge branch 'hn/test-ref-store-show-hash-algo'

Debugging support for refs API.

* hn/test-ref-store-show-hash-algo:
  test-ref-store: print hash algorithm

2 years agoMerge branch 'ws/fast-export-with-revision-options'
Junio C Hamano [Mon, 10 Jan 2022 19:52:50 +0000 (11:52 -0800)] 
Merge branch 'ws/fast-export-with-revision-options'

Use of certain "git rev-list" options with "git fast-export"
created nonsense results (the worst two of which being "--reverse"
and "--invert-grep --grep=<foo>").  The use of "--first-parent" is
made to behave a bit more sensible than before.

* ws/fast-export-with-revision-options:
  fast-export: fix surprising behavior with --first-parent

2 years agoMerge branch 'js/l10n-mention-ngettext-early-in-readme'
Junio C Hamano [Mon, 10 Jan 2022 19:52:49 +0000 (11:52 -0800)] 
Merge branch 'js/l10n-mention-ngettext-early-in-readme'

Localization doc update.

* js/l10n-mention-ngettext-early-in-readme:
  l10n: README: call more attention to plural strings

2 years agoMerge branch 'jh/p4-human-unit-numbers'
Junio C Hamano [Mon, 10 Jan 2022 19:52:49 +0000 (11:52 -0800)] 
Merge branch 'jh/p4-human-unit-numbers'

The way "git p4" shows file sizes in its output has been updated to
use human-readable units.

* jh/p4-human-unit-numbers:
  git-p4: show progress as an integer
  git-p4: print size values in appropriate units

2 years agoMerge branch 'ds/sparse-checkout-malformed-pattern-fix'
Junio C Hamano [Mon, 10 Jan 2022 19:52:49 +0000 (11:52 -0800)] 
Merge branch 'ds/sparse-checkout-malformed-pattern-fix'

Certain sparse-checkout patterns that are valid in non-cone mode
led to segfault in cone mode, which has been corrected.

* ds/sparse-checkout-malformed-pattern-fix:
  sparse-checkout: refuse to add to bad patterns
  sparse-checkout: fix OOM error with mixed patterns
  sparse-checkout: fix segfault on malformed patterns

2 years agocache.h: drop duplicate `ensure_full_index()` declaration
Martin Ågren [Mon, 10 Jan 2022 18:41:34 +0000 (19:41 +0100)] 
cache.h: drop duplicate `ensure_full_index()` declaration

There are two identical declarations of `ensure_full_index()` in
cache.h.

Commit 3964fc2aae ("sparse-index: add guard to ensure full index",
2021-03-30) provided an empty implementation of `ensure_full_index()`,
declaring it in a new file sparse-index.h. When commit 4300f8442a
("sparse-index: implement ensure_full_index()", 2021-03-30) fleshed out
the implementation, it added an identical declaration to cache.h.

Then 118a2e8bde ("cache: move ensure_full_index() to cache.h",
2021-04-01) favored having the declaration in cache.h. Because of the
double declaration, at that point we could have just dropped the one in
sparse-index.h, but instead it got moved to cache.h.

As a result, cache.h contains the exact same function declaration twice.
Drop the one under "/* Name hashing */", in favor of the one under
"/* Initialize and use the cache information */".

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Acked-by: Victoria Dye <vdye@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agolazyload: use correct calling conventions
Matthias Aßhauer [Sat, 8 Jan 2022 16:02:30 +0000 (16:02 +0000)] 
lazyload: use correct calling conventions

Christoph Reiter reported on the Git for Windows issue tracker[1], that
mingw_strftime() imports strftime() from ucrtbase.dll with the wrong
calling convention. It should be __cdecl instead of WINAPI, which we
always use in DECLARE_PROC_ADDR().

The MSYS2 project encountered cmake sefaults on x86 Windows caused by
the same issue in the cmake source. [2] There are no known git crashes
that where caused by this, yet, but we should try to prevent them.

We import two other non-WINAPI functions via DECLARE_PROC_ADDR(), too.

* NtSetSystemInformation() (NTAPI)
* GetUserNameExW()         (SEC_ENTRY)

NTAPI, SEC_ENTRY and WINAPI are all ususally defined as __stdcall,
but there are circumstances where they're defined differently.

Teach DECLARE_PROC_ADDR() about calling conventions and be explicit
about when we want to use which calling convention.

Import winnt.h for the definition of NTAPI and sspi.h for SEC_ENTRY
near their respective only users.

[1] https://github.com/git-for-windows/git/issues/3560
[2] https://github.com/msys2/MINGW-packages/issues/10152

Reported-By: Christoph Reiter <reiter.christoph@gmail.com>
Signed-off-by: Matthias Aßhauer <mha1993@live.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofetch: fix deadlock when cleaning up lockfiles in async signals
Patrick Steinhardt [Fri, 7 Jan 2022 10:55:47 +0000 (11:55 +0100)] 
fetch: fix deadlock when cleaning up lockfiles in async signals

When fetching packfiles, we write a bunch of lockfiles for the packfiles
we're writing into the repository. In order to not leave behind any
cruft in case we exit or receive a signal, we register both an exit
handler as well as signal handlers for common signals like SIGINT. These
handlers will then unlink the locks and free the data structure tracking
them. We have observed a deadlock in this logic though:

    (gdb) bt
    #0  __lll_lock_wait_private () at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:95
    #1  0x00007f4932bea2cd in _int_free (av=0x7f4932f2eb20 <main_arena>, p=0x3e3e4200, have_lock=0) at malloc.c:3969
    #2  0x00007f4932bee58c in __GI___libc_free (mem=<optimized out>) at malloc.c:2975
    #3  0x0000000000662ab1 in string_list_clear ()
    #4  0x000000000044f5bc in unlock_pack_on_signal ()
    #5  <signal handler called>
    #6  _int_free (av=0x7f4932f2eb20 <main_arena>, p=<optimized out>, have_lock=0) at malloc.c:4024
    #7  0x00007f4932bee58c in __GI___libc_free (mem=<optimized out>) at malloc.c:2975
    #8  0x000000000065afd5 in strbuf_release ()
    #9  0x000000000066ddb9 in delete_tempfile ()
    #10 0x0000000000610d0b in files_transaction_cleanup.isra ()
    #11 0x0000000000611718 in files_transaction_abort ()
    #12 0x000000000060d2ef in ref_transaction_abort ()
    #13 0x000000000060d441 in ref_transaction_prepare ()
    #14 0x000000000060e0b5 in ref_transaction_commit ()
    #15 0x00000000004511c2 in fetch_and_consume_refs ()
    #16 0x000000000045279a in cmd_fetch ()
    #17 0x0000000000407c48 in handle_builtin ()
    #18 0x0000000000408df2 in cmd_main ()
    #19 0x00000000004078b5 in main ()

The process was killed with a signal, which caused the signal handler to
kick in and try free the data structures after we have unlinked the
locks. It then deadlocks while calling free(3P).

The root cause of this is that it is not allowed to call certain
functions in async-signal handlers, as specified by signal-safety(7).
Next to most I/O functions, this list of disallowed functions also
includes memory-handling functions like malloc(3P) and free(3P) because
they may not be reentrant. As a result, if we execute such functions in
the signal handler, then they may operate on inconistent state and fail
in unexpected ways.

Fix this bug by not calling non-async-signal-safe functions when running
in the signal handler. We're about to re-raise the signal anyway and
will thus exit, so it's not much of a problem to keep the string list of
lockfiles untouched. Note that it's fine though to call unlink(2), so
we'll still clean up the lockfiles correctly.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Reviewed-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoThe seventh batch
Junio C Hamano [Wed, 5 Jan 2022 21:56:49 +0000 (13:56 -0800)] 
The seventh batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'rs/daemon-plug-leak'
Junio C Hamano [Wed, 5 Jan 2022 22:01:31 +0000 (14:01 -0800)] 
Merge branch 'rs/daemon-plug-leak'

Plug a memory leak.

* rs/daemon-plug-leak:
  daemon: plug memory leak on overlong path

2 years agoMerge branch 'rs/pcre2-utf'
Junio C Hamano [Wed, 5 Jan 2022 22:01:31 +0000 (14:01 -0800)] 
Merge branch 'rs/pcre2-utf'

"git grep --perl-regexp" failed to match UTF-8 characters with
wildcard when the pattern consists only of ASCII letters, which has
been corrected.

* rs/pcre2-utf:
  grep/pcre2: factor out literal variable
  grep/pcre2: use PCRE2_UTF even with ASCII patterns

2 years agoMerge branch 'jc/t4204-do-not-write-git-on-upstream-of-pipe'
Junio C Hamano [Wed, 5 Jan 2022 22:01:31 +0000 (14:01 -0800)] 
Merge branch 'jc/t4204-do-not-write-git-on-upstream-of-pipe'

Test fixes.

* jc/t4204-do-not-write-git-on-upstream-of-pipe:
  t4204 is not sanitizer clean at all

2 years agoMerge branch 'rs/log-invert-grep-with-headers'
Junio C Hamano [Wed, 5 Jan 2022 22:01:30 +0000 (14:01 -0800)] 
Merge branch 'rs/log-invert-grep-with-headers'

"git log --invert-grep --author=<name>" used to exclude commits
written by the given author, but now "--invert-grep" only affects
the matches made by the "--grep=<pattern>" option.

* rs/log-invert-grep-with-headers:
  log: let --invert-grep only invert --grep

2 years agoMerge branch 'gh/gpg-doc-markup-fix'
Junio C Hamano [Wed, 5 Jan 2022 22:01:30 +0000 (14:01 -0800)] 
Merge branch 'gh/gpg-doc-markup-fix'

Doc markup fix.

* gh/gpg-doc-markup-fix:
  docs: add missing colon to Documentation/config/gpg.txt

2 years agoMerge branch 'rs/t4202-invert-grep-test-fix'
Junio C Hamano [Wed, 5 Jan 2022 22:01:30 +0000 (14:01 -0800)] 
Merge branch 'rs/t4202-invert-grep-test-fix'

Test fix.

* rs/t4202-invert-grep-test-fix:
  t4202: fix patternType setting in --invert-grep test

2 years agoMerge branch 'ds/repack-fixlets'
Junio C Hamano [Wed, 5 Jan 2022 22:01:30 +0000 (14:01 -0800)] 
Merge branch 'ds/repack-fixlets'

Two fixes around "git repack".

* ds/repack-fixlets:
  repack: make '--quiet' disable progress
  repack: respect kept objects with '--write-midx -b'

2 years agoMerge branch 'jc/merge-detached-head-name'
Junio C Hamano [Wed, 5 Jan 2022 22:01:29 +0000 (14:01 -0800)] 
Merge branch 'jc/merge-detached-head-name'

The default merge message prepared by "git merge" records the name
of the current branch; the name can be overridden with a new option
to allow users to pretend a merge is made on a different branch.

* jc/merge-detached-head-name:
  merge: allow to pretend a merge is made into a different branch

2 years agoMerge branch 'km/help-prompt-fix'
Junio C Hamano [Wed, 5 Jan 2022 22:01:29 +0000 (14:01 -0800)] 
Merge branch 'km/help-prompt-fix'

Among some code paths that ask an yes/no question, only one place
gave a prompt that looked different from the others, which has been
updated to match what the others create.

* km/help-prompt-fix:
  help: make auto-correction prompt more consistent

2 years agoMerge branch 'jv/use-larger-buffer-in-upload-pack'
Junio C Hamano [Wed, 5 Jan 2022 22:01:29 +0000 (14:01 -0800)] 
Merge branch 'jv/use-larger-buffer-in-upload-pack'

"git upload-pack" (the other side of "git fetch") used a 8kB buffer
but most of its payload came on 64kB "packets".  The buffer size
has been enlarged so that such a packet fits.

* jv/use-larger-buffer-in-upload-pack:
  upload-pack.c: increase output buffer size

2 years agoMerge branch 'jk/ssh-signing-doc-markup-fix'
Junio C Hamano [Wed, 5 Jan 2022 22:01:29 +0000 (14:01 -0800)] 
Merge branch 'jk/ssh-signing-doc-markup-fix'

Docfix.

* jk/ssh-signing-doc-markup-fix:
  doc/config: mark ssh allowedSigners example as literal

2 years agoMerge branch 'pw/diff-color-moved-fix'
Junio C Hamano [Wed, 5 Jan 2022 22:01:29 +0000 (14:01 -0800)] 
Merge branch 'pw/diff-color-moved-fix'

Correctness and performance update to "diff --color-moved" feature.

* pw/diff-color-moved-fix:
  diff --color-moved: intern strings
  diff: use designated initializers for emitted_diff_symbol
  diff --color-moved-ws=allow-indentation-change: improve hash lookups
  diff --color-moved: stop clearing potential moved blocks
  diff --color-moved: shrink potential moved blocks as we go
  diff --color-moved: unify moved block growth functions
  diff --color-moved: call comparison function directly
  diff --color-moved-ws=allow-indentation-change: simplify and optimize
  diff: simplify allow-indentation-change delta calculation
  diff --color-moved: avoid false short line matches and bad zebra coloring
  diff --color-moved=zebra: fix alternate coloring
  diff --color-moved: rewind when discarding pmb
  diff --color-moved: factor out function
  diff --color-moved: clear all flags on blocks that are too short
  diff --color-moved: add perf tests

2 years agoMerge branch 'xw/am-empty'
Junio C Hamano [Wed, 5 Jan 2022 22:01:28 +0000 (14:01 -0800)] 
Merge branch 'xw/am-empty'

"git am" learns "--empty=(stop|drop|keep)" option to tweak what is
done to a piece of e-mail without a patch in it.

* xw/am-empty:
  am: support --allow-empty to record specific empty patches
  am: support --empty=<option> to handle empty patches
  doc: git-format-patch: describe the option --always

2 years agoMerge branch 'en/keep-cwd'
Junio C Hamano [Wed, 5 Jan 2022 22:01:28 +0000 (14:01 -0800)] 
Merge branch 'en/keep-cwd'

Many git commands that deal with working tree files try to remove a
directory that becomes empty (i.e. "git switch" from a branch that
has the directory to another branch that does not would attempt
remove all files in the directory and the directory itself).  This
drops users into an unfamiliar situation if the command was run in
a subdirectory that becomes subject to removal due to the command.
The commands have been taught to keep an empty directory if it is
the directory they were started in to avoid surprising users.

* en/keep-cwd:
  t2501: simplify the tests since we can now assume desired behavior
  dir: new flag to remove_dir_recurse() to spare the original_cwd
  dir: avoid incidentally removing the original_cwd in remove_path()
  stash: do not attempt to remove startup_info->original_cwd
  rebase: do not attempt to remove startup_info->original_cwd
  clean: do not attempt to remove startup_info->original_cwd
  symlinks: do not include startup_info->original_cwd in dir removal
  unpack-trees: add special cwd handling
  unpack-trees: refuse to remove startup_info->original_cwd
  setup: introduce startup_info->original_cwd
  t2501: add various tests for removing the current working directory

2 years agoMerge branch 'jc/flex-array-definition'
Junio C Hamano [Wed, 5 Jan 2022 22:01:27 +0000 (14:01 -0800)] 
Merge branch 'jc/flex-array-definition'

The conditions to choose different definitions of the FLEX_ARRAY
macro for vendor compilers has been simplified to make it easier to
maintain.

* jc/flex-array-definition:
  flex-array: simplify compiler-specific workaround

2 years agoMerge branch 'jh/p4-rcs-expansion-in-bytestring'
Junio C Hamano [Wed, 5 Jan 2022 22:01:27 +0000 (14:01 -0800)] 
Merge branch 'jh/p4-rcs-expansion-in-bytestring'

The RCS keyword substitution in "git p4" used to be done assuming
that the contents are UTF-8 text, which can trigger decoding
errors.  We now treat the contents as a bytestring for robustness
and correctness.

* jh/p4-rcs-expansion-in-bytestring:
  git-p4: resolve RCS keywords in bytes not utf-8
  git-p4: open temporary patch file for write only
  git-p4: add raw option to read_pipelines
  git-p4: pre-compile RCS keyword regexes
  git-p4: use with statements to close files after use in patchRCSKeywords

2 years agoi18n: turn even more messages into "cannot be used together" ones
Jean-Noël Avila [Wed, 5 Jan 2022 20:02:24 +0000 (20:02 +0000)] 
i18n: turn even more messages into "cannot be used together" ones

Even if some of these messages are not subject to gettext i18n, this
helps bring a single style of message for a given error type.

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Reviewed-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoi18n: ref-filter: factorize "%(foo) atom used without %(bar) atom"
Jean-Noël Avila [Wed, 5 Jan 2022 20:02:23 +0000 (20:02 +0000)] 
i18n: ref-filter: factorize "%(foo) atom used without %(bar) atom"

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Reviewed-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoi18n: factorize "--foo outside a repository"
Jean-Noël Avila [Wed, 5 Jan 2022 20:02:22 +0000 (20:02 +0000)] 
i18n: factorize "--foo outside a repository"

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Reviewed-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoi18n: refactor "unrecognized %(foo) argument" strings
Jean-Noël Avila [Wed, 5 Jan 2022 20:02:21 +0000 (20:02 +0000)] 
i18n: refactor "unrecognized %(foo) argument" strings

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Reviewed-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoi18n: factorize "no directory given for --foo"
Jean-Noël Avila [Wed, 5 Jan 2022 20:02:20 +0000 (20:02 +0000)] 
i18n: factorize "no directory given for --foo"

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Reviewed-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoi18n: factorize "--foo requires --bar" and the like
Jean-Noël Avila [Wed, 5 Jan 2022 20:02:19 +0000 (20:02 +0000)] 
i18n: factorize "--foo requires --bar" and the like

They are all replaced by "the option '%s' requires '%s'", which is a
new string but replaces 17 previous unique strings.

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Reviewed-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoi18n: tag.c factorize i18n strings
Jean-Noël Avila [Wed, 5 Jan 2022 20:02:18 +0000 (20:02 +0000)] 
i18n: tag.c factorize i18n strings

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Reviewed-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoi18n: standardize "cannot open" and "cannot read"
Jean-Noël Avila [Wed, 5 Jan 2022 20:02:17 +0000 (20:02 +0000)] 
i18n: standardize "cannot open" and "cannot read"

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Reviewed-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoi18n: turn "options are incompatible" into "cannot be used together"
Jean-Noël Avila [Wed, 5 Jan 2022 20:02:16 +0000 (20:02 +0000)] 
i18n: turn "options are incompatible" into "cannot be used together"

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Reviewed-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoi18n: refactor "%s, %s and %s are mutually exclusive"
Jean-Noël Avila [Wed, 5 Jan 2022 20:02:15 +0000 (20:02 +0000)] 
i18n: refactor "%s, %s and %s are mutually exclusive"

Use placeholders for constant tokens. The strings are turned into
"cannot be used together"

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Reviewed-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoi18n: refactor "foo and bar are mutually exclusive"
Jean-Noël Avila [Wed, 5 Jan 2022 20:02:14 +0000 (20:02 +0000)] 
i18n: refactor "foo and bar are mutually exclusive"

Use static strings for constant parts of the sentences. They are all
turned into "cannot be used together".

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Reviewed-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agogrep: align default colors with GNU grep ones
Lénaïc Huard [Wed, 5 Jan 2022 08:18:35 +0000 (09:18 +0100)] 
grep: align default colors with GNU grep ones

git-grep shares a lot of options with the standard grep tool.
Like GNU grep, it has coloring options to highlight the matching text.
And like it, it has options to customize the various colored parts.

This patch updates the default git-grep colors to make them match the
GNU grep default ones [1].

It was possible to get the same result by setting the various `color.grep.<slot>`
options, but this patch makes `git grep --color` share the same color scheme as
`grep --color` by default without any user configuration.

[1] https://www.man7.org/linux/man-pages/man1/grep.1.html#ENVIRONMENT

Signed-off-by: Lénaïc Huard <lenaic@lhuard.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot/README: fix typo
Marc Strapetz [Tue, 4 Jan 2022 23:17:04 +0000 (23:17 +0000)] 
t/README: fix typo

Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agostash: do not return before restoring untracked files
Elijah Newren [Tue, 4 Jan 2022 23:04:58 +0000 (23:04 +0000)] 
stash: do not return before restoring untracked files

In commit bee8691f19 ("stash: restore untracked files AFTER restoring
tracked files", 2021-09-10), we correctly identified that we should
restore changes to tracked files before attempting to restore untracked
files, and accordingly moved the code for restoring untracked files a
few lines down in do_apply_stash().  Unfortunately, the intervening
lines had some early return statements meaning that we suddenly stopped
restoring untracked files in some cases.

Even before the previous commit, there was another possible issue with
the current code -- a post-stash-apply 'git status' that was intended
to be run after restoring the stash was skipped when we hit a conflict
(or other error condition), which seems slightly inconsistent.

Fix both issues by saving the return status, and letting other
functionality run before returning.

Reported-by: AJ Henderson
Test-case-by: Randall S. Becker <randall.becker@nexbridge.ca>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agosubtree: fix argument handling in check_parents
James Limbouris [Wed, 8 Dec 2021 02:11:58 +0000 (02:11 +0000)] 
subtree: fix argument handling in check_parents

315a84f9aa0 (subtree: use commits before rejoins for splits, 2018-09-28)
changed the signature of check_parents from 'check_parents [REV...]'
to 'check_parents PARENTS_EXPR INDENT'. In other words the variable list
of parent revisions became a list embedded in a string. However it
neglected to unpack the list again before sending it to cache_miss,
leading to incorrect calls whenever more than one parent was present.
This is the case whenever a merge commit is processed, with the end
result being a loss of performance from unecessary rechecks.

The indent parameter was subsequently removed in e9525a8a029 (subtree:
have $indent actually affect indentation, 2021-04-27), but the argument
handling bug remained.

For consistency, take multiple arguments in check_parents,
and pass all of them to cache_miss separately.

Signed-off-by: James Limbouris <james@digitalmatter.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoThe sixth batch
Junio C Hamano [Tue, 4 Jan 2022 00:23:32 +0000 (16:23 -0800)] 
The sixth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'en/sparse-checkout-set'
Junio C Hamano [Tue, 4 Jan 2022 00:24:15 +0000 (16:24 -0800)] 
Merge branch 'en/sparse-checkout-set'

The "init" and "set" subcommands in "git sparse-checkout" have been
unified for a better user experience and performance.

* en/sparse-checkout-set:
  sparse-checkout: remove stray trailing space
  clone: avoid using deprecated `sparse-checkout init`
  Documentation: clarify/correct a few sparsity related statements
  git-sparse-checkout.txt: update to document init/set/reapply changes
  sparse-checkout: enable reapply to take --[no-]{cone,sparse-index}
  sparse-checkout: enable `set` to initialize sparse-checkout mode
  sparse-checkout: split out code for tweaking settings config
  sparse-checkout: disallow --no-stdin as an argument to set
  sparse-checkout: add sanity-checks on initial sparsity state
  sparse-checkout: break apart functions for sparse_checkout_(set|add)
  sparse-checkout: pass use_stdin as a parameter instead of as a global

2 years agoMerge branch 'es/test-chain-lint'
Junio C Hamano [Tue, 4 Jan 2022 00:24:15 +0000 (16:24 -0800)] 
Merge branch 'es/test-chain-lint'

Broken &&-chains in the test scripts have been corrected.

* es/test-chain-lint:
  t6000-t9999: detect and signal failure within loop
  t5000-t5999: detect and signal failure within loop
  t4000-t4999: detect and signal failure within loop
  t0000-t3999: detect and signal failure within loop
  tests: simplify by dropping unnecessary `for` loops
  tests: apply modern idiom for exiting loop upon failure
  tests: apply modern idiom for signaling test failure
  tests: fix broken &&-chains in `{...}` groups
  tests: fix broken &&-chains in `$(...)` command substitutions
  tests: fix broken &&-chains in compound statements
  tests: use test_write_lines() to generate line-oriented output
  tests: simplify construction of large blocks of text
  t9107: use shell parameter expansion to avoid breaking &&-chain
  t6300: make `%(raw:size) --shell` test more robust
  t5516: drop unnecessary subshell and command invocation
  t4202: clarify intent by creating expected content less cleverly
  t1020: avoid aborting entire test script when one test fails
  t1010: fix unnoticed failure on Windows
  t/lib-pager: use sane_unset() to avoid breaking &&-chain

2 years agoMerge branch 'ns/tmp-objdir'
Junio C Hamano [Tue, 4 Jan 2022 00:24:14 +0000 (16:24 -0800)] 
Merge branch 'ns/tmp-objdir'

New interface into the tmp-objdir API to help in-core use of the
quarantine feature.

* ns/tmp-objdir:
  tmp-objdir: disable ref updates when replacing the primary odb
  tmp-objdir: new API for creating temporary writable databases

2 years agoMerge branch 'jc/unleak-log'
Junio C Hamano [Tue, 4 Jan 2022 00:24:14 +0000 (16:24 -0800)] 
Merge branch 'jc/unleak-log'

"git format-patch" uses a single rev_info instance and then exits.
Mark the structure with UNLEAK() macro to squelch leak sanitizer.

* jc/unleak-log:
  format-patch: mark rev_info with UNLEAK

2 years agosparse-checkout: refuse to add to bad patterns
Derrick Stolee [Thu, 16 Dec 2021 16:13:42 +0000 (16:13 +0000)] 
sparse-checkout: refuse to add to bad patterns

When in cone mode sparse-checkout, it is unclear how 'git
sparse-checkout add <dir1> ...' should behave if the existing
sparse-checkout file does not match the cone mode patterns. Change the
behavior to fail with an error message about the existing patterns.

Also, all cone mode patterns start with a '/' character, so add that
restriction. This is necessary for our example test 'cone mode: warn on
bad pattern', but also requires modifying the example sparse-checkout
file we use to test the warnings related to recognizing cone mode
patterns.

This error checking would cause a failure further down the test script
because of a test that adds non-cone mode patterns without cleaning them
up. Perform that cleanup as part of the test now.

Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agosparse-checkout: fix OOM error with mixed patterns
Derrick Stolee [Thu, 16 Dec 2021 16:13:41 +0000 (16:13 +0000)] 
sparse-checkout: fix OOM error with mixed patterns

Add a test to t1091-sparse-checkout-builtin.sh that would result in an
infinite loop and out-of-memory error before this change. The issue
relies on having non-cone-mode patterns while trying to modify the
patterns in cone-mode.

The fix is simple, allowing us to break from the loop when the input
path does not contain a slash, as the "dir" pattern we added does not.

This is only a fix to the critical out-of-memory error. A better
response to such a strange state will follow in a later change.

Reported-by: Calbabreaker <calbabreaker@gmail.com>
Helped-by: Taylor Blau <me@ttaylorr.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agosparse-checkout: fix segfault on malformed patterns
Derrick Stolee [Thu, 16 Dec 2021 16:13:40 +0000 (16:13 +0000)] 
sparse-checkout: fix segfault on malformed patterns

Then core.sparseCheckoutCone is enabled, the sparse-checkout patterns are
used to populate two hashsets that accelerate pattern matching. If the user
modifies the sparse-checkout file outside of the 'sparse-checkout' builtin,
then strange patterns can happen, triggering some error checks.

One of these error checks is possible to hit when some special characters
exist in a line. A warning message is correctly written to stderr, but then
there is additional logic that attempts to remove the line from the hashset
and free the data. This leads to a segfault in the 'git sparse-checkout
list' command because it iterates over the contents of the hashset, which is
now invalid.

The fix here is to stop trying to remove from the hashset. In addition,
we disable cone mode sparse-checkout because of the malformed data. This
results in the pattern-matching working with a possibly-slower
algorithm, but using the patterns as they are in the sparse-checkout
file.

This also changes the behavior of commands such as 'git sparse-checkout
list' because the output patterns will be the contents of the
sparse-checkout file instead of the list of directories. This is an
existing behavior for other types of bad patterns.

Add a test that triggers the segfault without the code change.

Reported-by: John Burnett <johnburnett@johnburnett.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoSubmittingPatchs: clarify choice of base and testing
Junio C Hamano [Thu, 30 Dec 2021 20:18:35 +0000 (12:18 -0800)] 
SubmittingPatchs: clarify choice of base and testing

We encourage identifying what, among many topics on `next`, exact
topics a new work depends on, instead of building directly on
`next`.  Let's clarify this in the documentation.

Developers should know what they are building on top of, and be
aware of which part of the system is currently being worked on.
Encouraging them to make trial merges to `next` and `seen`
themselves will incentivize them to read others' changes and
understand them, eventually helping the developers to coordinate
among themselves and reviewing each others' changes.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agomerge-ort: fix bug with renormalization and rename/delete conflicts
Elijah Newren [Tue, 28 Dec 2021 00:20:46 +0000 (00:20 +0000)] 
merge-ort: fix bug with renormalization and rename/delete conflicts

Ever since commit a492d5331c ("merge-ort: ensure we consult df_conflict
and path_conflicts", 2021-06-30), when renormalization is active AND a
file is involved in a rename/delete conflict BUT the file is unmodified
(either before or after renormalization), merge-ort was running into an
assertion failure.  Prior to that commit (or if assertions were compiled
out), merge-ort would mis-merge instead, ignoring the rename/delete
conflict and just deleting the file.

Remove the assertions, fix the code appropriately, leave some good
comments in the code, and add a testcase for this situation.

Reported-by: Ralf Thielow <ralf.thielow@gmail.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMakefile: don't invoke msgfmt with --statistics
Ævar Arnfjörð Bjarmason [Fri, 17 Dec 2021 00:10:00 +0000 (01:10 +0100)] 
Makefile: don't invoke msgfmt with --statistics

Remove the --statistics flag that I added in 5e9637c6297 (i18n: add
infrastructure for translating Git with gettext, 2011-11-18). Our
Makefile output is good about reducing verbosity by default, except in
this case:

    $ rm -rf po/build/locale/e*; time make -j $(nproc) all
        SUBDIR templates
        MKDIR -p po/build/locale/el/LC_MESSAGES
        MSGFMT po/build/locale/el/LC_MESSAGES/git.mo
        MKDIR -p po/build/locale/es/LC_MESSAGES
        MSGFMT po/build/locale/es/LC_MESSAGES/git.mo
    1038 translated messages, 3325 untranslated messages.
    5230 translated messages.

I didn't have any good reason for using --statistics at the time other
than ad-hoc eyeballing of the output. We don't need to spew out
exactly how many messages we've got translated every time. Now we'll
instead emit:

    $ rm -rf po/build/locale/e*; time make -j $(nproc) all
        SUBDIR templates
        MKDIR -p po/build/locale/el/LC_MESSAGES
        MSGFMT po/build/locale/el/LC_MESSAGES/git.mo
        MKDIR -p po/build/locale/es/LC_MESSAGES
        MSGFMT po/build/locale/es/LC_MESSAGES/git.mo

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMakefile: move -DPAGER_ENV from BASIC_CFLAGS to EXTRA_CPPFLAGS
Ævar Arnfjörð Bjarmason [Fri, 17 Dec 2021 00:19:15 +0000 (01:19 +0100)] 
Makefile: move -DPAGER_ENV from BASIC_CFLAGS to EXTRA_CPPFLAGS

Remove -DPAGER_ENV from the BASIC_CFLAGS and instead have it passed
via the EXTRA_CPPFLAGS passed when compiling pager.c.

This doesn't change anything except to make it clear that only pager.c
needs this, as it's the only user of this define. See
995bc22d7f8 (pager: move pager-specific setup into the build,
2016-08-04) for the commit that originally added this.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMakefile: correct the dependency graph of hook-list.h
Ævar Arnfjörð Bjarmason [Fri, 17 Dec 2021 00:13:01 +0000 (01:13 +0100)] 
Makefile: correct the dependency graph of hook-list.h

Fix an issue in my cfe853e66be (hook-list.h: add a generated list of
hooks, like config-list.h, 2021-09-26), the builtin/help.c was
inadvertently made to depend on hook-list.h, but it's used by
builtin/bugreport.c.

The hook.c also does not depend on hook-list.h. It did in an earlier
version of the greater series cfe853e66be was extracted from, but not
anymore. We might end up needing that line again, but let's remove it
for now.

Reported-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot/perf: do not run tests in user's $SHELL
Johannes Altmanninger [Sat, 25 Dec 2021 08:16:58 +0000 (09:16 +0100)] 
t/perf: do not run tests in user's $SHELL

The environment variable $SHELL is usually set to the user's
interactive shell. Our build and test scripts never use $SHELL because
there are no guarantees about its input language.  Instead, we use
/bin/sh which should be a POSIX shell.

For systems with a broken /bin/sh, we allow to override that path via
SHELL_PATH.  To run tests in yet another shell we allow to override
SHELL_PATH with TEST_SHELL_PATH.

Perf tests run in $SHELL via a wrapper defined in t/perf/perf-lib.sh,
so they break with e.g. SHELL=python.  Use TEST_SHELL_PATH like
in other tests.  TEST_SHELL_PATH is always defined because
t/perf/perf-lib.sh includes t/test-lib.sh, which includes
GIT-BUILD-OPTIONS.

Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Johannes Altmanninger <aclopte@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>