]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
2 years agoarchive: improve documentation of --prefix
René Scharfe [Sat, 28 May 2022 06:57:46 +0000 (08:57 +0200)] 
archive: improve documentation of --prefix

Document the interaction between --add-file and --prefix by giving an
example.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoGit 2.35.3 v2.35.3
Junio C Hamano [Wed, 13 Apr 2022 22:21:34 +0000 (15:21 -0700)] 
Git 2.35.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoGit 2.34.3 v2.34.3
Junio C Hamano [Wed, 13 Apr 2022 22:21:31 +0000 (15:21 -0700)] 
Git 2.34.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoGit 2.33.3 v2.33.3
Junio C Hamano [Wed, 13 Apr 2022 22:21:28 +0000 (15:21 -0700)] 
Git 2.33.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoGit 2.32.2 v2.32.2
Junio C Hamano [Wed, 13 Apr 2022 22:21:26 +0000 (15:21 -0700)] 
Git 2.32.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoGit 2.31.3 v2.31.3
Junio C Hamano [Wed, 13 Apr 2022 22:21:08 +0000 (15:21 -0700)] 
Git 2.31.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoGit 2.30.4 v2.30.4
Junio C Hamano [Wed, 13 Apr 2022 20:31:29 +0000 (13:31 -0700)] 
Git 2.30.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agosetup: opt-out of check with safe.directory=*
Derrick Stolee [Wed, 13 Apr 2022 15:32:31 +0000 (15:32 +0000)] 
setup: opt-out of check with safe.directory=*

With the addition of the safe.directory in 8959555ce
(setup_git_directory(): add an owner check for the top-level directory,
2022-03-02) released in v2.35.2, we are receiving feedback from a
variety of users about the feature.

Some users have a very large list of shared repositories and find it
cumbersome to add this config for every one of them.

In a more difficult case, certain workflows involve running Git commands
within containers. The container boundary prevents any global or system
config from communicating `safe.directory` values from the host into the
container. Further, the container almost always runs as a different user
than the owner of the directory in the host.

To simplify the reactions necessary for these users, extend the
definition of the safe.directory config value to include a possible '*'
value. This value implies that all directories are safe, providing a
single setting to opt-out of this protection.

Note that an empty assignment of safe.directory clears all previous
values, and this is already the case with the "if (!value || !*value)"
condition.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agosetup: fix safe.directory key not being checked
Matheus Valadares [Wed, 13 Apr 2022 15:32:30 +0000 (15:32 +0000)] 
setup: fix safe.directory key not being checked

It seems that nothing is ever checking to make sure the safe directories
in the configs actually have the key safe.directory, so some unrelated
config that has a value with a certain directory would also make it a
safe directory.

Signed-off-by: Matheus Valadares <me@m28.io>
Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot0033: add tests for safe.directory
Derrick Stolee [Wed, 13 Apr 2022 15:32:29 +0000 (15:32 +0000)] 
t0033: add tests for safe.directory

It is difficult to change the ownership on a directory in our test
suite, so insert a new GIT_TEST_ASSUME_DIFFERENT_OWNER environment
variable to trick Git into thinking we are in a differently-owned
directory. This allows us to test that the config is parsed correctly.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoGit 2.35.2 v2.35.2
Johannes Schindelin [Thu, 17 Mar 2022 09:58:00 +0000 (10:58 +0100)] 
Git 2.35.2

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2 years agoSync with 2.34.2
Johannes Schindelin [Thu, 17 Mar 2022 09:57:59 +0000 (10:57 +0100)] 
Sync with 2.34.2

* maint-2.34:
  Git 2.34.2
  Git 2.33.2
  Git 2.32.1
  Git 2.31.2
  GIT-VERSION-GEN: bump to v2.33.1
  Git 2.30.3
  setup_git_directory(): add an owner check for the top-level directory
  Add a function to determine whether a path is owned by the current user

2 years agoGit 2.34.2 v2.34.2
Johannes Schindelin [Thu, 17 Mar 2022 09:57:52 +0000 (10:57 +0100)] 
Git 2.34.2

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2 years agoSync with 2.33.2
Johannes Schindelin [Thu, 17 Mar 2022 09:57:50 +0000 (10:57 +0100)] 
Sync with 2.33.2

* maint-2.33:
  Git 2.33.2
  Git 2.32.1
  Git 2.31.2
  GIT-VERSION-GEN: bump to v2.33.1
  Git 2.30.3
  setup_git_directory(): add an owner check for the top-level directory
  Add a function to determine whether a path is owned by the current user

2 years agoGit 2.33.2 v2.33.2
Johannes Schindelin [Thu, 17 Mar 2022 09:57:44 +0000 (10:57 +0100)] 
Git 2.33.2

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2 years agoSync with 2.32.1
Johannes Schindelin [Thu, 17 Mar 2022 09:57:43 +0000 (10:57 +0100)] 
Sync with 2.32.1

* maint-2.32:
  Git 2.32.1
  Git 2.31.2
  Git 2.30.3
  setup_git_directory(): add an owner check for the top-level directory
  Add a function to determine whether a path is owned by the current user

2 years agoGit 2.32.1 v2.32.1
Johannes Schindelin [Thu, 17 Mar 2022 09:57:38 +0000 (10:57 +0100)] 
Git 2.32.1

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2 years agoSync with 2.31.2
Johannes Schindelin [Thu, 17 Mar 2022 09:57:37 +0000 (10:57 +0100)] 
Sync with 2.31.2

* maint-2.31:
  Git 2.31.2
  Git 2.30.3
  setup_git_directory(): add an owner check for the top-level directory
  Add a function to determine whether a path is owned by the current user

2 years agoGit 2.31.2 v2.31.2
Johannes Schindelin [Thu, 17 Mar 2022 09:57:32 +0000 (10:57 +0100)] 
Git 2.31.2

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2 years agoSync with 2.30.3
Johannes Schindelin [Thu, 17 Mar 2022 09:57:31 +0000 (10:57 +0100)] 
Sync with 2.30.3

* maint-2.30:
  Git 2.30.3
  setup_git_directory(): add an owner check for the top-level directory
  Add a function to determine whether a path is owned by the current user

2 years agoGit 2.30.3 v2.30.3
Johannes Schindelin [Thu, 17 Mar 2022 09:15:15 +0000 (10:15 +0100)] 
Git 2.30.3

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2 years agoFix `GIT_CEILING_DIRECTORIES` with `C:\` and the likes
Johannes Schindelin [Wed, 23 Mar 2022 22:00:41 +0000 (23:00 +0100)] 
Fix `GIT_CEILING_DIRECTORIES` with `C:\` and the likes

When determining the length of the longest ancestor of a given path with
respect to to e.g. `GIT_CEILING_DIRECTORIES`, we special-case the root
directory by returning 0 (i.e. we pretend that the path `/` does not end
in a slash by virtually stripping it).

That is the correct behavior because when normalizing paths, the root
directory is special: all other directory paths have their trailing
slash stripped, but not the root directory's path (because it would
become the empty string, which is not a legal path).

However, this special-casing of the root directory in
`longest_ancestor_length()` completely forgets about Windows-style root
directories, e.g. `C:\`. These _also_ get normalized with a trailing
slash (because `C:` would actually refer to the current directory on
that drive, not necessarily to its root directory).

In fc56c7b34b (mingw: accomodate t0060-path-utils for MSYS2,
2016-01-27), we almost got it right. We noticed that
`longest_ancestor_length()` expects a slash _after_ the matched prefix,
and if the prefix already ends in a slash, the normalized path won't
ever match and -1 is returned.

But then that commit went astray: The correct fix is not to adjust the
_tests_ to expect an incorrect -1 when that function is fed a prefix
that ends in a slash, but instead to treat such a prefix as if the
trailing slash had been removed.

Likewise, that function needs to handle the case where it is fed a path
that ends in a slash (not only a prefix that ends in a slash): if it
matches the prefix (plus trailing slash), we still need to verify that
the path does not end there, otherwise the prefix is not actually an
ancestor of the path but identical to it (and we need to return -1 in
that case).

With these two adjustments, we no longer need to play games in t0060
where we only add `$rootoff` if the passed prefix is different from the
MSYS2 pseudo root, instead we also add it for the MSYS2 pseudo root
itself. We do have to be careful to skip that logic entirely for Windows
paths, though, because they do are not subject to that MSYS2 pseudo root
treatment.

This patch fixes the scenario where a user has set
`GIT_CEILING_DIRECTORIES=C:\`, which would be ignored otherwise.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2 years agosetup_git_directory(): add an owner check for the top-level directory
Johannes Schindelin [Wed, 2 Mar 2022 11:23:04 +0000 (12:23 +0100)] 
setup_git_directory(): add an owner check for the top-level directory

It poses a security risk to search for a git directory outside of the
directories owned by the current user.

For example, it is common e.g. in computer pools of educational
institutes to have a "scratch" space: a mounted disk with plenty of
space that is regularly swiped where any authenticated user can create
a directory to do their work. Merely navigating to such a space with a
Git-enabled `PS1` when there is a maliciously-crafted `/scratch/.git/`
can lead to a compromised account.

The same holds true in multi-user setups running Windows, as `C:\` is
writable to every authenticated user by default.

To plug this vulnerability, we stop Git from accepting top-level
directories owned by someone other than the current user. We avoid
looking at the ownership of each and every directories between the
current and the top-level one (if there are any between) to avoid
introducing a performance bottleneck.

This new default behavior is obviously incompatible with the concept of
shared repositories, where we expect the top-level directory to be owned
by only one of its legitimate users. To re-enable that use case, we add
support for adding exceptions from the new default behavior via the
config setting `safe.directory`.

The `safe.directory` config setting is only respected in the system and
global configs, not from repository configs or via the command-line, and
can have multiple values to allow for multiple shared repositories.

We are particularly careful to provide a helpful message to any user
trying to use a shared repository.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2 years agoAdd a function to determine whether a path is owned by the current user
Johannes Schindelin [Wed, 2 Mar 2022 10:06:24 +0000 (11:06 +0100)] 
Add a function to determine whether a path is owned by the current user

This function will be used in the next commit to prevent
`setup_git_directory()` from discovering a repository in a directory
that is owned by someone other than the current user.

Note: We cannot simply use `st.st_uid` on Windows just like we do on
Linux and other Unix-like platforms: according to
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/stat-functions
this field is always zero on Windows (because Windows' idea of a user ID
does not fit into a single numerical value). Therefore, we have to do
something a little involved to replicate the same functionality there.

Also note: On Windows, a user's home directory is not actually owned by
said user, but by the administrator. For all practical purposes, it is
under the user's control, though, therefore we pretend that it is owned
by the user.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2 years agoMerge branch 'cb/mingw-gmtime-r'
Johannes Schindelin [Thu, 17 Mar 2022 11:52:12 +0000 (12:52 +0100)] 
Merge branch 'cb/mingw-gmtime-r'

Build fix on Windows.

* cb/mingw-gmtime-r:
  mingw: avoid fallback for {local,gm}time_r()

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2 years agomingw: avoid fallback for {local,gm}time_r()
Carlo Marcelo Arenas Belón [Sat, 27 Nov 2021 10:15:32 +0000 (10:15 +0000)] 
mingw: avoid fallback for {local,gm}time_r()

mingw-w64's pthread_unistd.h had a bug that mistakenly (because there is
no support for the *lockfile() functions required[1]) defined
_POSIX_THREAD_SAFE_FUNCTIONS and that was being worked around since
3ecd153a3b (compat/mingw: support MSys2-based MinGW build, 2016-01-14).

The bug was fixed in winphtreads, but as a side effect, leaves the
reentrant functions from time.h no longer visible and therefore breaks
the build.

Since the intention all along was to avoid using the fallback functions,
formalize the use of POSIX by setting the corresponding feature flag and
compile out the implementation for the fallback functions.

[1] https://unix.org/whitepapers/reentrant.html

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoGIT-VERSION-GEN: bump to v2.33.1
Johannes Schindelin [Thu, 17 Mar 2022 09:35:52 +0000 (10:35 +0100)] 
GIT-VERSION-GEN: bump to v2.33.1

This was missed in af6d1d602a8f (Git 2.33.1, 2021-10-12).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2 years agoGit 2.35.1 v2.35.1
Junio C Hamano [Sat, 29 Jan 2022 00:48:42 +0000 (16:48 -0800)] 
Git 2.35.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'en/keep-cwd' into maint
Junio C Hamano [Sat, 29 Jan 2022 00:45:39 +0000 (16:45 -0800)] 
Merge branch 'en/keep-cwd' into maint

Fix a regression in 2.35 that roke the use of "rebase" and "stash"
in a secondary worktree.

* en/keep-cwd:
  sequencer, stash: fix running from worktree subdir

2 years agosequencer, stash: fix running from worktree subdir
Elijah Newren [Wed, 26 Jan 2022 01:43:45 +0000 (01:43 +0000)] 
sequencer, stash: fix running from worktree subdir

In commits bc3ae46b42 ("rebase: do not attempt to remove
startup_info->original_cwd", 2021-12-09) and 0fce211ccc ("stash: do not
attempt to remove startup_info->original_cwd", 2021-12-09), we wanted to
allow the subprocess to know which directory the parent process was
running from, so that the subprocess could protect it.  However...

When run from a non-main worktree, setup_git_directory() will note
that the discovered git directory
(/PATH/TO/.git/worktree/non-main-worktree) does not match
DEFAULT_GIT_DIR_ENVIRONMENT (see setup_discovered_git_dir()), and
decide to set GIT_DIR in the environment.  This matters because...

Whenever git is run with the GIT_DIR environment variable set, and
GIT_WORK_TREE not set, it presumes that '.' is the working tree.  So...

This combination results in the subcommand being very confused about
the working tree.  Fix it by also setting the GIT_WORK_TREE environment
variable along with setting cmd.dir.

A possibly more involved fix we could consider for later would be to
make setup.c set GIT_WORK_TREE whenever (a) it discovers both the git
directory and the working tree and (b) it decides to set GIT_DIR in the
environment.  I did not attempt that here as such would be too big of a
change for a 2.35.1 release.

Test-case-by: Glen Choo <chooglen@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoGit 2.35 v2.35.0
Junio C Hamano [Mon, 24 Jan 2022 17:25:25 +0000 (09:25 -0800)] 
Git 2.35

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'ab/checkout-branch-info-leakfix'
Junio C Hamano [Mon, 24 Jan 2022 17:14:46 +0000 (09:14 -0800)] 
Merge branch 'ab/checkout-branch-info-leakfix'

We added an unrelated sanity checking that leads to a BUG() while
plugging a leak, which triggered in a repository with symrefs in
the local branch namespace that point at a ref outside.  Partially
revert the change to avoid triggering the BUG().

* ab/checkout-branch-info-leakfix:
  checkout: avoid BUG() when hitting a broken repository

2 years agoMerge tag 'l10n-2.35.0-rnd2' of git://github.com/git-l10n/git-po
Junio C Hamano [Mon, 24 Jan 2022 17:09:34 +0000 (09:09 -0800)] 
Merge tag 'l10n-2.35.0-rnd2' of git://github.com/git-l10n/git-po

l10n-2.35.0-rnd2

* tag 'l10n-2.35.0-rnd2' of git://github.com/git-l10n/git-po:
  l10n: Update Catalan translation
  l10n: zh_TW: v2.35.0 round 2 (0 untranslated)
  l10n: Update Catalan translation
  l10n: de.po: Update German translation
  l10n: de.po: Fix translation for "'%s' is aliased to '%s'"
  l10n: po-id for 2.35 (round 2)
  l10n: Update Catalan translation
  l10n: vi(5195t): Update for v2.35.0 round 2
  l10n: batch update to fix typo in branch.c
  l10n: git.pot: v2.35.0 round 2 (1 new, 1 removed)
  l10n: bg.po: Updated Bulgarian translation (5195t)
  l10n: zh_CN: v2.35.0 round 1
  l10n: fr: v2.35.0 round 1
  l10n: zh_TW: v2.35.0 round 1 (1 fuzzy)
  l10n: po-id for 2.35 (round 1)
  l10n: sv.po: Update Swedish translation (5196t0f0u)
  l10n: sv.po: Fix typo
  l10n: tr: v2.35.0 round 1
  l10n: git.pot: v2.35.0 round 1 (126 new, 142 removed)

2 years agol10n: Update Catalan translation
Jordi Mas [Sun, 23 Jan 2022 08:40:52 +0000 (09:40 +0100)] 
l10n: Update Catalan translation

Signed-off-by: Jordi Mas <jmas@softcatala.org>
2 years agoMerge branch 'l10n/zh_TW/220113' of github.com:l10n-tw/git-po
Jiang Xin [Sat, 22 Jan 2022 08:27:41 +0000 (16:27 +0800)] 
Merge branch 'l10n/zh_TW/220113' of github.com:l10n-tw/git-po

* 'l10n/zh_TW/220113' of github.com:l10n-tw/git-po:
  l10n: zh_TW: v2.35.0 round 2 (0 untranslated)
  l10n: zh_TW: v2.35.0 round 1 (1 fuzzy)

2 years agocheckout: avoid BUG() when hitting a broken repository
Junio C Hamano [Sat, 22 Jan 2022 00:58:30 +0000 (16:58 -0800)] 
checkout: avoid BUG() when hitting a broken repository

When 9081a421 (checkout: fix "branch info" memory leaks, 2021-11-16)
cleaned up existing memory leaks, we added an unrelated sanity check
to ensure that a local branch is truly local and not a symref to
elsewhere that dies with BUG() otherwise.  This was misguided in two
ways.  First of all, such a tightening did not belong to a leak-fix
patch.  And the condition it detected was *not* a bug in our program
but a problem in user data, where warning() or die() would have been
more appropriate.

As the condition is not fatal (the result of computing the local
branch name in the code that is involved in the faulty check is only
used as a textual label for the commit), let's revert the code to
the original state, i.e. strip "refs/heads/" to compute the local
branch name if possible, and otherwise leave it NULL.  The consumer
of the information in merge_working_tree() is prepared to see NULL
in there and act accordingly.

cf. https://bugzilla.redhat.com/show_bug.cgi?id=2042920

Reported-by: Petr Šplíchal <psplicha@redhat.com>
Reported-by: Todd Zullinger <tmz@pobox.com>
Helped-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agol10n: zh_TW: v2.35.0 round 2 (0 untranslated)
Yi-Jyun Pan [Fri, 21 Jan 2022 23:06:36 +0000 (07:06 +0800)] 
l10n: zh_TW: v2.35.0 round 2 (0 untranslated)

Used 1 translation from zh_CN. Thanks to zh_CN translation team!

Signed-off-by: Yi-Jyun Pan <pan93412@gmail.com>
2 years agol10n: Update Catalan translation
Jordi Mas [Fri, 21 Jan 2022 06:56:02 +0000 (07:56 +0100)] 
l10n: Update Catalan translation

Signed-off-by: Jordi Mas <jmas@softcatala.org>
2 years agoMerge branch 'js/branch-track-inherit'
Junio C Hamano [Thu, 20 Jan 2022 23:25:38 +0000 (15:25 -0800)] 
Merge branch 'js/branch-track-inherit'

"git branch -h" incorrectly said "--track[=direct|inherit]",
implying that "--trackinherit" is a valid option, which has been
corrected.
source: <3de40324bea6a1dd9bca2654721471e3809e87d8.1642538935.git.steadmon@google.com>
source: <c3c26192-aee9-185a-e559-b8735139e49c@web.de>

* js/branch-track-inherit:
  branch,checkout: fix --track documentation

2 years agobranch,checkout: fix --track documentation
René Scharfe [Thu, 20 Jan 2022 12:35:54 +0000 (13:35 +0100)] 
branch,checkout: fix --track documentation

Document that the accepted variants of the --track option are --track,
--track=direct, and --track=inherit.  The equal sign in the latter two
cannot be replaced with whitespace; in general optional arguments need
to be attached firmly to their option.

Put "direct" consistently before "inherit", if only for the reasons
that the former is the default, explained first in the documentation,
and comes before the latter alphabetically.

Mention both modes in the short help so that readers don't have to look
them up in the full documentation.  They are literal strings and thus
untranslatable.  PARSE_OPT_LITERAL_ARGHELP is inferred due to the pipe
and parenthesis characters, so we don't have to provide that flag
explicitly.

Mention that -t has the same effect as --track and --track=direct.
There is no way to specify inherit mode using the short option, because
short options generally don't accept optional arguments.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agol10n: de.po: Update German translation
Matthias Rüster [Sat, 15 Jan 2022 15:36:51 +0000 (16:36 +0100)] 
l10n: de.po: Update German translation

Signed-off-by: Matthias Rüster <matthias.ruester@gmail.com>
Reviewed-by: Ralf Thielow <ralf.thielow@gmail.com>
2 years agol10n: de.po: Fix translation for "'%s' is aliased to '%s'"
Jürgen Krämer [Thu, 18 Nov 2021 15:25:48 +0000 (16:25 +0100)] 
l10n: de.po: Fix translation for "'%s' is aliased to '%s'"

The German translation for "'%s' is aliased to '%s'" is incorrect. It
switches the order of alias name and alias definition.

A better translation would be "'%s' ist ein Alias für '%s'". (Full stop
removed intentionally, because the original does not use one either.)

Signed-off-by: Matthias Rüster <matthias.ruester@gmail.com>
2 years agoMerge branch 'po-id' of github.com:bagasme/git-po
Jiang Xin [Thu, 20 Jan 2022 02:40:08 +0000 (10:40 +0800)] 
Merge branch 'po-id' of github.com:bagasme/git-po

* 'po-id' of github.com:bagasme/git-po:
  l10n: po-id for 2.35 (round 2)

2 years agoGit 2.35-rc2 v2.35.0-rc2
Junio C Hamano [Wed, 19 Jan 2022 20:48:46 +0000 (12:48 -0800)] 
Git 2.35-rc2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agogetcwd(mingw): handle the case when there is no cwd
Johannes Schindelin [Wed, 19 Jan 2022 18:56:01 +0000 (18:56 +0000)] 
getcwd(mingw): handle the case when there is no cwd

A recent upstream topic introduced checks for certain Git commands that
prevent them from deleting the current working directory, introducing
also a regression test that ensures that commands such as `git version`
_can_ run without a current working directory.

While technically not possible on Windows via the regular Win32 API, we
do run the regression tests in an MSYS2 Bash which uses a POSIX
emulation layer (the MSYS2/Cygwin runtime) where a really evil hack
_does_ allow to delete a directory even if it is the current working
directory.

Therefore, Git needs to be prepared for a missing working directory,
even on Windows.

This issue was not noticed in upstream Git because there was no caller
that tried to discover a Git directory with a deleted current working
directory in the test suite. But in the microsoft/git fork, we do want
to run `pre-command`/`post-command` hooks for every command, even for
`git version`, which means that we make precisely such a call. The bug
is not in that `pre-command`/`post-command` feature, though, but in
`mingw_getcwd()` and needs to be addressed there.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agol10n: po-id for 2.35 (round 2)
Bagas Sanjaya [Tue, 18 Jan 2022 08:27:07 +0000 (15:27 +0700)] 
l10n: po-id for 2.35 (round 2)

Translate following new components:

  * advice.c
  * alias.c
  * sequencer.c
  * sparse-index.c
  * builtin/sparse-checkout.c

Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
2 years agol10n: Update Catalan translation
Jordi Mas [Wed, 19 Jan 2022 06:50:14 +0000 (07:50 +0100)] 
l10n: Update Catalan translation

Signed-off-by: Jordi Mas <jmas@softcatala.org>
2 years agoMerge branch 'js/branch-track-inherit'
Junio C Hamano [Wed, 19 Jan 2022 00:02:23 +0000 (16:02 -0800)] 
Merge branch 'js/branch-track-inherit'

"git branch -h" incorrectly said "--track[=direct|inherit]",
implying that "--trackinherit" is a valid option, which has been
corrected.

* js/branch-track-inherit:
  branch,checkout: fix --track usage strings

2 years agoMerge branch 'jc/freebsd-without-c99-only-build'
Junio C Hamano [Wed, 19 Jan 2022 00:02:23 +0000 (16:02 -0800)] 
Merge branch 'jc/freebsd-without-c99-only-build'

FreeBSD 13.0 headers have unconditional dependency on C11 language
features, and adding -std=gnu99 to DEVELOPER_CFLAGS would just
break the developer build.

* jc/freebsd-without-c99-only-build:
  Makefile: FreeBSD cannot do C99-or-below build

2 years agobranch,checkout: fix --track usage strings
Josh Steadmon [Tue, 18 Jan 2022 20:49:46 +0000 (12:49 -0800)] 
branch,checkout: fix --track usage strings

As Ævar pointed out in [1], the use of PARSE_OPT_LITERAL_ARGHELP with a
list of allowed parameters is not recommended. Both git-branch and
git-checkout were changed in d311566 (branch: add flags and config to
inherit tracking, 2021-12-20) to use this discouraged combination for
their --track flags.

Fix this by removing PARSE_OPT_LITERAL_ARGHELP, and changing the arghelp
to simply be "mode". Users may discover allowed values in the manual
pages.

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

Signed-off-by: Josh Steadmon <steadmon@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMakefile: FreeBSD cannot do C99-or-below build
Junio C Hamano [Tue, 18 Jan 2022 17:47:39 +0000 (09:47 -0800)] 
Makefile: FreeBSD cannot do C99-or-below build

In "make DEVELOPER=YesPlease" builds, we try to help developers to
catch as many potential issues as they can by using -Wall and
turning compilation warnings into errors.  In the same spirit, we
recently started adding -std=gnu99 to their CFLAGS, so that they can
notice when they accidentally used language features beyond C99.

It however turns out that FreeBSD 13.0 mistakenly uses C11 extension
in its system header files regardless of what __STDC_VERSION__ says,
which means that the platform (unless we tweak their system headers)
cannot be used for this purpose.

It seems that -std=gnu99 is only added conditionally even in today's
config.mak.dev, so it is fine if we dropped -std=gnu99 from there.
Which means that developers on FreeBSD cannot participate in vetting
use of features beyond C99, but there are developers on other
platforms who will, so it's not too bad.

We might want a more "fundamental" fix to make the platform capable
of taking -std=gnu99, like working around the use of unconditional
C11 extension in its system header files by supplying a set of
"replacement" definitions in our header files.  We chose not to
pursue such an approach for two reasons at this point:

 (1) The fix belongs to the FreeBSD project, not this project, and
     such an upstream fix may happen hopefully in a not-too-distant
     future.

 (2) Fixing such a bug in system header files and working it around
     can lead to unexpected breakages (other parts of their system
     header files may not be expecting to see and do not work well
     with our "replacement" definitions).  This close to the final
     release of this cycle, we have no time for that.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
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 agol10n: vi(5195t): Update for v2.35.0 round 2
Tran Ngoc Quan [Mon, 17 Jan 2022 07:15:31 +0000 (14:15 +0700)] 
l10n: vi(5195t): Update for v2.35.0 round 2

Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>
2 years agol10n: batch update to fix typo in branch.c
Jiang Xin [Mon, 17 Jan 2022 00:50:41 +0000 (08:50 +0800)] 
l10n: batch update to fix typo in branch.c

In git 2.35 l10n round 1, a space between two words was missing in the
message from "branch.c", and it was fixed by commit 68d924e1de (branch:
missing space fix at line 313, 2022-01-11).

Do a batch update for teams (bg, fr, id, sv, tr and zh_CN) that have
already completed their works on l10n round 1.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2 years agol10n: git.pot: v2.35.0 round 2 (1 new, 1 removed)
Jiang Xin [Mon, 17 Jan 2022 00:32:09 +0000 (08:32 +0800)] 
l10n: git.pot: v2.35.0 round 2 (1 new, 1 removed)

Generate po/git.pot from v2.35.0-rc1 for git v2.35.0 l10n round 2.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2 years agoMerge tag 'v2.35.0-rc1'
Jiang Xin [Mon, 17 Jan 2022 00:30:45 +0000 (08:30 +0800)] 
Merge tag 'v2.35.0-rc1'

Git 2.35-rc1

* tag 'v2.35.0-rc1':
  Git 2.35-rc1
  reftable tests: avoid "int" overflow, use "uint64_t"
  reftable: avoid initializing structs from structs
  t1450-fsck: exec-bit is not needed to make loose object writable
  refs API: use "failure_errno", not "errno"
  Last minute fixes before -rc1
  build: NonStop ships with an older zlib
  packfile: fix off-by-one error in decoding logic
  t/gpg: simplify test for unknown key
  branch: missing space fix at line 313
  fmt-merge-msg: prevent use-after-free with signed tags
  cache.h: drop duplicate `ensure_full_index()` declaration
  lazyload: use correct calling conventions
  fetch: fix deadlock when cleaning up lockfiles in async signals

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 agol10n: bg.po: Updated Bulgarian translation (5195t)
Alexander Shopov [Sat, 15 Jan 2022 22:35:45 +0000 (23:35 +0100)] 
l10n: bg.po: Updated Bulgarian translation (5195t)

Signed-off-by: Alexander Shopov <ash@kambanaria.org>
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 agol10n: zh_CN: v2.35.0 round 1
Fangyi Zhou [Tue, 11 Jan 2022 16:42:06 +0000 (16:42 +0000)] 
l10n: zh_CN: v2.35.0 round 1

- Translate new messages
- Translate the word 'cone' instead of leaving it verbatim
  (in the context of sparse checkout)
- Make translations of 'failed to' consistent

Signed-off-by: Fangyi Zhou <me@fangyi.io>
Reviewed-by: Teng Long <dyroneteng@gmail.com>
Reviewed-by: 依云 <lilydjwg@gmail.com>
Reviewed-by: Jiang Xin <worldhello.net@gmail.com>
2 years agoMerge branch 'fr_2.35.0_rnd1' of github.com:jnavila/git
Jiang Xin [Thu, 13 Jan 2022 01:11:17 +0000 (09:11 +0800)] 
Merge branch 'fr_2.35.0_rnd1' of github.com:jnavila/git

* 'fr_2.35.0_rnd1' of github.com:jnavila/git:
  l10n: fr: v2.35.0 round 1

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 agol10n: fr: v2.35.0 round 1
Jean-Noël Avila [Wed, 12 Jan 2022 20:14:45 +0000 (21:14 +0100)] 
l10n: fr: v2.35.0 round 1

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
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 agol10n: zh_TW: v2.35.0 round 1 (1 fuzzy)
Yi-Jyun Pan [Wed, 12 Jan 2022 17:10:46 +0000 (01:10 +0800)] 
l10n: zh_TW: v2.35.0 round 1 (1 fuzzy)

Signed-off-by: Yi-Jyun Pan <pan93412@gmail.com>
2 years agol10n: po-id for 2.35 (round 1)
Bagas Sanjaya [Tue, 11 Jan 2022 12:21:51 +0000 (19:21 +0700)] 
l10n: po-id for 2.35 (round 1)

Update following components:
  * apply.c
  * branch.c
  * builtin/add.c
  * builtin/am.c
  * builtin/fetch.c
  * builtin/ls-files.c
  * builtin/stash.c

Translate following new components:
  * archive-tar.c
  * archive-zip.c

Also clean up obsolete translations.

Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
2 years agoMerge branch 'master' of github.com:nafmo/git-l10n-sv
Jiang Xin [Wed, 12 Jan 2022 05:46:21 +0000 (13:46 +0800)] 
Merge branch 'master' of github.com:nafmo/git-l10n-sv

* 'master' of github.com:nafmo/git-l10n-sv:
  l10n: sv.po: Update Swedish translation (5196t0f0u)
  l10n: sv.po: Fix typo

2 years agol10n: sv.po: Update Swedish translation (5196t0f0u)
Peter Krefting [Tue, 11 Jan 2022 15:36:26 +0000 (16:36 +0100)] 
l10n: sv.po: Update Swedish translation (5196t0f0u)

Includes extra translation for branch.c:313 which has an
upstream whitespace error that is expected to be fixed.

Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
2 years agol10n: sv.po: Fix typo
Peter Krefting [Sat, 8 Jan 2022 20:11:34 +0000 (21:11 +0100)] 
l10n: sv.po: Fix typo

Suggested-by: Anders Jonsson <anders.jonsson@norsjovallen.se>
Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
2 years agol10n: tr: v2.35.0 round 1
Emir SARI [Tue, 11 Jan 2022 10:08:26 +0000 (13:08 +0300)] 
l10n: tr: v2.35.0 round 1

Signed-off-by: Emir SARI <emir_sari@icloud.com>
2 years agol10n: git.pot: v2.35.0 round 1 (126 new, 142 removed)
Jiang Xin [Tue, 11 Jan 2022 01:52:27 +0000 (09:52 +0800)] 
l10n: git.pot: v2.35.0 round 1 (126 new, 142 removed)

Generate po/git.pot from v2.35.0-rc0 for git v2.35.0 l10n round 1.

Signed-off-by: Jiang Xin <worldhello.net@gmail.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