]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
8 weeks agoMerge branch 'js/doc-gitk-history' into next
Junio C Hamano [Thu, 21 Aug 2025 21:35:32 +0000 (14:35 -0700)] 
Merge branch 'js/doc-gitk-history' into next

Manual page for "gitk" is updated with the current maintainer's
name.

* js/doc-gitk-history:
  doc/gitk: update reference to the external project

8 weeks agoMerge branch 'jk/describe-blob' into next
Junio C Hamano [Thu, 21 Aug 2025 21:35:32 +0000 (14:35 -0700)] 
Merge branch 'jk/describe-blob' into next

"git describe <blob>" misbehaves and/or crashes in some corner
cases, which has been taught to exit with failure gracefully.

* jk/describe-blob:
  describe: pass commit to describe_commit()
  describe: handle blob traversal with no commits
  describe: catch unborn branch in describe_blob()
  describe: error if blob not found
  describe: pass oid struct by const pointer

8 weeks agoMerge branch 'jk/no-clobber-dangling-symref-with-fetch' into next
Junio C Hamano [Thu, 21 Aug 2025 21:35:31 +0000 (14:35 -0700)] 
Merge branch 'jk/no-clobber-dangling-symref-with-fetch' into next

"git fetch" can clobber a symref that is dangling when the
remote-tracking HEAD is set to auto update, which has been
corrected.

* jk/no-clobber-dangling-symref-with-fetch:
  refs: do not clobber dangling symrefs
  t5510: prefer "git -C" to subshell for followRemoteHEAD tests
  t5510: stop changing top-level working directory
  t5510: make confusing config cleanup more explicit

8 weeks agoMerge branch 'ds/doc-community-discord' into next
Junio C Hamano [Thu, 21 Aug 2025 21:35:30 +0000 (14:35 -0700)] 
Merge branch 'ds/doc-community-discord' into next

Discord has been added to the first contribution documentation as
another way to ask for help.

* ds/doc-community-discord:
  doc: add discord to ways of getting help

8 weeks agoMerge branch 'ps/reftable-libgit2-cleanup' into next
Junio C Hamano [Thu, 21 Aug 2025 21:35:30 +0000 (14:35 -0700)] 
Merge branch 'ps/reftable-libgit2-cleanup' into next

Code clean-ups.

* ps/reftable-libgit2-cleanup:
  refs/reftable: always reload stacks when creating lock
  reftable: don't second-guess errors from flock interface
  reftable/stack: handle outdated stacks when compacting
  reftable/stack: allow passing flags to `reftable_stack_add()`
  reftable/stack: fix compiler warning due to missing braces
  reftable/stack: reorder code to avoid forward declarations
  reftable/writer: drop Git-specific `QSORT()` macro
  reftable/writer: fix type used for number of records

8 weeks agoMerge branch 'ad/t1517-short-help-tests-fix' into next
Junio C Hamano [Thu, 21 Aug 2025 21:35:29 +0000 (14:35 -0700)] 
Merge branch 'ad/t1517-short-help-tests-fix' into next

Test fix.

* ad/t1517-short-help-tests-fix:
  t/t1517: mark tests that fail with GIT_TEST_INSTALLED

8 weeks agodoc: add discord to ways of getting help
Daniele Sassoli [Wed, 20 Aug 2025 08:36:58 +0000 (08:36 +0000)] 
doc: add discord to ways of getting help

Discord is a great way of receiving help for members of the community
that are not on the mailing list or not familiar with Libera.

Adding it to the official documentation will aid discoverability of it.

The link is the same as the one at https://git-scm.com/community.

Signed-off-by: Daniele Sassoli <danielesassoli@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 weeks agodescribe: pass commit to describe_commit()
Jeff King [Mon, 18 Aug 2025 21:04:17 +0000 (17:04 -0400)] 
describe: pass commit to describe_commit()

There's a call in describe_commit() to lookup_commit_reference(), but we
don't check the return value. If it returns NULL, we'll segfault as we
immediately dereference the result.

In practice this can never happen, since all callers pass an oid which
came from a "struct commit" already. So we can make this more obvious
by just taking that commit struct in the first place.

Reported-by: Cheng <prophecheng@stu.pku.edu.cn>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 weeks agodescribe: handle blob traversal with no commits
Jeff King [Wed, 20 Aug 2025 06:30:34 +0000 (02:30 -0400)] 
describe: handle blob traversal with no commits

When describing a blob, we traverse from HEAD, remembering each commit
we saw, and then checking each blob to report the containing commit.
But if we haven't seen any commits at all, we'll segfault (we store the
"current" commit as an oid initialized to the null oid, causing
lookup_commit_reference() to return NULL).

This shouldn't be able to happen normally. We always start our traversal
at HEAD, which must be a commit (a property which is enforced by the
refs code). But you can trigger the segfault like this:

  blob=$(echo foo | git hash-object -w --stdin)
  echo $blob >.git/HEAD
  git describe $blob

We can instead catch this case and return an empty result, which hits
the usual "we didn't find $blob while traversing HEAD" error.

This is a minor lie in that we did "find" the blob. And this even hints
at a bigger problem in this code: what if the traversal pointed to the
blob as _not_ part of a commit at all, but we had previously filled in
the recorded "current commit"? One could imagine this happening due to a
tag pointing directly to the blob in question.

But that can't happen, because we only traverse from HEAD, never from
any other refs. And the intent of the blob-describing code is to find
blobs within commits.

So I think this matches the original intent as closely as we can (and
again, this segfault cannot be triggered without corrupting your
repository!).

The test here does not use the formula above, which works only for the
files backend (and not reftables). Instead we use another loophole to
create the bogus state using only Git commands. See the comment in the
test for details.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 weeks agodoc/gitk: update reference to the external project
Johannes Sixt [Wed, 20 Aug 2025 06:16:05 +0000 (08:16 +0200)] 
doc/gitk: update reference to the external project

Gitk is now maintained by Johannes Sixt and the repository can be
cloned from a new URL. b59358100c20 (Update the official repo of
gitk, 2024-12-24) could have updated this instance in the manual,
too, but the opportunity was missed. Update it now. Do give credit
to Paul Mackerras as the inventor of the program.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoMerge branch 'lo/repo-info' into next
Junio C Hamano [Tue, 19 Aug 2025 23:38:23 +0000 (16:38 -0700)] 
Merge branch 'lo/repo-info' into next

A new subcommand "git repo" gives users a way to grab various
repository characteristics.

* lo/repo-info:
  repo: add the --format flag
  repo: add the field layout.shallow
  repo: add the field layout.bare
  repo: add the field references.format
  repo: declare the repo command

2 months agorefs: do not clobber dangling symrefs
Jeff King [Tue, 19 Aug 2025 19:29:34 +0000 (15:29 -0400)] 
refs: do not clobber dangling symrefs

When given an expected "before" state, the ref-writing code will avoid
overwriting any ref that does not match that expected state. We use the
null oid as a sentinel value for "nothing should exist", and likewise
that is the sentinel value we get when trying to read a ref that does
not exist.

But there's one corner case where this is ambiguous: dangling symrefs.
Trying to read them will yield the null oid, but there is potentially
something of value there: the dangling symref itself.

For a normal recursive write, this is OK. Imagine we have a symref
"FOO_HEAD" that points to a ref "refs/heads/bar" that does not exist,
and we try to write to it with a create operation like:

  oid=$(git rev-parse HEAD) ;# or whatever
  git symbolic-ref FOO_HEAD refs/heads/bar
  echo "create FOO_HEAD $oid" | git update-ref --stdin

The attempt to resolve FOO_HEAD will actually resolve "bar", yielding
the null oid. That matches our expectation, and the write proceeds. This
is correct, because we are not writing FOO_HEAD at all, but writing its
destination "bar", which in fact does not exist.

But what if the operation asked not to dereference symrefs? Like this:

  echo "create FOO_HEAD $oid" | git update-ref --no-deref --stdin

Resolving FOO_HEAD would still result in a null oid, and the write will
proceed. But it will overwrite FOO_HEAD itself, removing the fact that
it ever pointed to "bar".

This case is a little esoteric; we are clobbering a symref with a
no-deref write of a regular ref value. But the same problem occurs when
writing symrefs. For example:

  echo "symref-create FOO_HEAD refs/heads/other" |
  git update-ref --no-deref --stdin

The "create" operation asked us to create FOO_HEAD only if it did not
exist. But we silently overwrite the existing value.

You can trigger this without using update-ref via the fetch
followRemoteHEAD code. In "create" mode, it should not overwrite an
existing value. But if you manually create a symref pointing to a value
that does not yet exist (either via symbolic-ref or with "remote add
-m"), create mode will happily overwrite it.

Instead, we should detect this case and refuse to write. The correct
specification to overwrite FOO_HEAD in this case is to provide an
expected target ref value, like:

  echo "symref-update FOO_HEAD refs/heads/other ref refs/heads/bar" |
  git update-ref --no-deref --stdin

Note that the non-symref "update" directive does not allow you to do
this (you can only specify an oid). This is a weakness in the update-ref
interface, and you'd have to overwrite unconditionally, like:

  echo "update FOO_HEAD $oid" | git update-ref --no-deref --stdin

Likewise other symref operations like symref-delete do not accept the
"ref" keyword. You should be able to do:

  echo "symref-delete FOO_HEAD ref refs/heads/bar"

but cannot (and can only delete unconditionally). This patch doesn't
address those gaps. We may want to do so in a future patch for
completeness, but it's not clear if anybody actually wants to perform
those operations. The symref update case (specifically, via
followRemoteHEAD) is what I ran into in the wild.

The code for the fix is relatively straight-forward given the discussion
above. But note that we have to implement it independently for the files
and reftable backends. The "old oid" checks happen as part of the
locking process, which is implemented separately for each system. We may
want to factor this out somehow, but it's beyond the scope of this
patch. (Another curiosity is that the messages in the reftable code are
marked for translation, but the ones in the files backend are not. I
followed local convention in each case, but we may want to harmonize
this at some point).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agot5510: prefer "git -C" to subshell for followRemoteHEAD tests
Jeff King [Tue, 19 Aug 2025 19:27:16 +0000 (15:27 -0400)] 
t5510: prefer "git -C" to subshell for followRemoteHEAD tests

These tests set config within a sub-repo using (cd two && git config),
and then a separate test_when_finished outside the subshell to clean it
up. We can't use test_config to do this, because the cleanup command it
registers inside the subshell would be lost. Nor can we do it before
entering the subshell, because the config has to be set after some other
commands are run.

Let's switch these tests to use "git -C" for each command instead of a
subshell. That lets us use test_config (with -C also) at the appropriate
part of the test. And we no longer need the manual cleanup command.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agot5510: stop changing top-level working directory
Jeff King [Tue, 19 Aug 2025 19:26:06 +0000 (15:26 -0400)] 
t5510: stop changing top-level working directory

Several tests in t5510 do a bare "cd subrepo", not in a subshell. This
changes the working directory for subsequent tests. As a result, almost
every test has to start with "cd $D" to go back to the top-level.

Our usual style is to do per-test environment changes like this in a
subshell, so that tests can assume they are starting at the top-level
$TRASH_DIRECTORY.

Let's switch to that style, which lets us drop all of that extra
path-handling.

Most cases can switch to using a subshell, but in a few spots we can
simplify by doing "git init foo && git -C foo ...". We do have to make
sure that we weren't intentionally touching the environment in any code
which was moved into a subshell (e.g., with a test_when_finished), but
that isn't the case for any of these tests.

All of the references to the $D variable can go away, replaced generally
with $PWD or $TRASH_DIRECTORY (if we use it inside a chdir'd subshell).
Note in one test, "fetch --prune prints the remotes url", we make sure
to use $(pwd) to get the Windows-style path on that platform (for the
other tests, the exact form doesn't matter).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agot5510: make confusing config cleanup more explicit
Jeff King [Tue, 19 Aug 2025 19:24:55 +0000 (15:24 -0400)] 
t5510: make confusing config cleanup more explicit

Several tests set a config variable in a sub-repo we chdir into via a
subshell, like this:

  (
cd "$D" &&
cd two &&
git config foo.bar baz
  )

But they also clean up the variable with a when_finished directive
outside of the subshell, like this:

  test_when_finished "git config unset foo.bar"

At first glance, this shouldn't work! The cleanup clause cannot be run
from the subshell (since environment changes there are lost by the time
the test snippet finishes). But since the cleanup command runs outside
the subshell, our working directory will not have been switched into
"two".

But it does work. Why?

The answer is that an earlier test does a "cd two" that moves the whole
test's working directory out of $TRASH_DIRECTORY and into "two". So the
subshell is a bit of a red herring; we are already in the right
directory! That's why we need the "cd $D" at the top of the shell, to
put us back to a known spot.

Let's make this cleanup code more explicitly specify where we expect the
config command to run. That makes the script more robust against running
a subset of the tests, and ultimately will make it easier to refactor
the script to avoid these top-level chdirs.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agot/t1517: mark tests that fail with GIT_TEST_INSTALLED
Adam Dinwoodie [Tue, 19 Aug 2025 07:43:29 +0000 (08:43 +0100)] 
t/t1517: mark tests that fail with GIT_TEST_INSTALLED

The changes added by 39fc408562 (t/t1517: automate `git subcmd -h` tests
outside a repository, 2025-08-08) to automatically loop over all "main"
Git commands will, when run against an installed build using
GIT_TEST_INSTALLED rather than the build in the build directory, include
some extra git-gui commands that are installed by `make install`, or
credential helpers that might be installed manually from the contrib
directories.  These fail the test, so record them as such.

Signed-off-by: Adam Dinwoodie <adam@dinwoodie.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoRevert "Merge branch 'ad/t1517-short-help-tests-fix' into next"
Junio C Hamano [Tue, 19 Aug 2025 15:37:29 +0000 (08:37 -0700)] 
Revert "Merge branch 'ad/t1517-short-help-tests-fix' into next"

This reverts commit b38fb9afd38e96cca62c2457e8fb33058ecbfe77, reversing
changes made to dddb2275d413451f7a01ff3f6c08fe0c6ce8f7b9.

2 months agodescribe: catch unborn branch in describe_blob()
Jeff King [Mon, 18 Aug 2025 21:01:54 +0000 (17:01 -0400)] 
describe: catch unborn branch in describe_blob()

When describing a blob, we search for it by traversing from HEAD. We do
this by feeding the name HEAD to setup_revisions(). But if we are on an
unborn branch, this will fail with a confusing message:

  $ git describe $blob
  fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
  Use '--' to separate paths from revisions, like this:
  'git <command> [<revision>...] -- [<file>...]'

It is OK for this to be an error (we cannot find $blob in an empty
traversal, so we'd eventually complain about that). But the error
message could be more helpful.

Let's resolve HEAD ourselves and pass the resolved object id to
setup_revisions(). If resolving fails, then we can print a more useful
message.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agodescribe: error if blob not found
Jeff King [Mon, 18 Aug 2025 21:01:25 +0000 (17:01 -0400)] 
describe: error if blob not found

If describe_blob() does not find the blob in question, it returns an
empty strbuf, and we print an empty line. This differs from
describe_commit(), which always either returns an answer or calls die()
itself. As the blob function was bolted onto the command afterwards, I
think its behavior is not intentional, and it is just a bug that it does
not report an error.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agodescribe: pass oid struct by const pointer
Jeff King [Mon, 18 Aug 2025 20:59:29 +0000 (16:59 -0400)] 
describe: pass oid struct by const pointer

We pass a "struct object_id" to describe_blob() by value. This isn't
wrong, as an oid is composed only of copy-able values. But it's unusual;
typically we pass structs by const pointer, including object_ids. Let's
do so.

It similarly makes sense for us to hold that pointer in the callback
data (rather than yet another copy of the oid).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoSync with Git 2.51
Junio C Hamano [Mon, 18 Aug 2025 00:19:29 +0000 (17:19 -0700)] 
Sync with Git 2.51

2 months agoGit 2.51 v2.51.0
Junio C Hamano [Mon, 18 Aug 2025 00:18:23 +0000 (17:18 -0700)] 
Git 2.51

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoSync with 'master'
Junio C Hamano [Sun, 17 Aug 2025 16:27:19 +0000 (09:27 -0700)] 
Sync with 'master'

2 months agoMerge branch 'ps/commit-graph-wo-globals' into next
Junio C Hamano [Sun, 17 Aug 2025 16:27:08 +0000 (09:27 -0700)] 
Merge branch 'ps/commit-graph-wo-globals' into next

Remove dependency on the_repository and other globals from the
commit-graph code, and other changes unrelated to de-globaling.

* ps/commit-graph-wo-globals:
  commit-graph: stop passing in redundant repository
  commit-graph: stop using `the_repository`
  commit-graph: stop using `the_hash_algo`
  commit-graph: refactor `parse_commit_graph()` to take a repository
  commit-graph: store the hash algorithm instead of its length
  commit-graph: stop using `the_hash_algo` via macros

2 months agoMerge branch 'ds/doc-count-objects-fix' into next
Junio C Hamano [Sun, 17 Aug 2025 16:27:07 +0000 (09:27 -0700)] 
Merge branch 'ds/doc-count-objects-fix' into next

Docfix.

* ds/doc-count-objects-fix:
  count-objects: document count-objects pack

2 months agoMerge branch 'dk/t7005-editor-updates' into next
Junio C Hamano [Sun, 17 Aug 2025 16:27:07 +0000 (09:27 -0700)] 
Merge branch 'dk/t7005-editor-updates' into next

Test clean-up.

* dk/t7005-editor-updates:
  t7005: sanitize test environment for subsequent tests
  t7005: stop abusing --exec-path
  t7005: use modern test style

2 months agoMerge branch 'ja/doc-lint-sections-and-synopsis' into next
Junio C Hamano [Sun, 17 Aug 2025 16:27:06 +0000 (09:27 -0700)] 
Merge branch 'ja/doc-lint-sections-and-synopsis' into next

Doc lint updates to encourage the newer and easier-to-use
`synopsis` format, with fixes to a handful of existing uses.

* ja/doc-lint-sections-and-synopsis:
  doc lint: check that synopsis manpages have synopsis inlines
  doc:git-for-each-ref: fix styling and typos
  doc: check for absence of the form --[no-]parameter
  doc: check for absence of multiple terms in each entry of desc list
  doc: check well-formedness of delimited sections
  doc: test linkgit macros for well-formedness

2 months agoMerge branch 'ad/t1517-short-help-tests-fix' into next
Junio C Hamano [Sun, 17 Aug 2025 16:27:05 +0000 (09:27 -0700)] 
Merge branch 'ad/t1517-short-help-tests-fix' into next

* ad/t1517-short-help-tests-fix:
  t/t1517: mark tests that fail with GIT_TEST_INSTALLED

2 months agoMerge tag 'l10n-2.51.0-2' of https://github.com/git-l10n/git-po
Junio C Hamano [Sun, 17 Aug 2025 16:22:16 +0000 (09:22 -0700)] 
Merge tag 'l10n-2.51.0-2' of https://github.com/git-l10n/git-po

l10n-2.51.0-2

* tag 'l10n-2.51.0-2' of https://github.com/git-l10n/git-po:
  l10n: Update Catalan Translation for Git 2.51-rc2
  l10n: zh_CN: updated translation for 2.51
  l10n: uk: add 2.51 translation
  l10n: zh_TW: Git 2.51
  l10n: po-id for 2.51
  l10n: fr translation update for v2.51.0
  l10n: tr: Update Turkish translations for 2.51.0
  l10n: Updated translation for vi-2.51
  l10n: sv.po: Update Swedish translation
  l10n: bg.po: Updated Bulgarian translation (5856t)

2 months agorepo: add the --format flag
Lucas Seiki Oshiro [Sat, 16 Aug 2025 22:46:03 +0000 (19:46 -0300)] 
repo: add the --format flag

Add the --format flag to git-repo-info. By using this flag, the users
can choose the format for obtaining the data they requested.

Given that this command can be used for generating input for other
applications and for being read by end users, it requires at least two
formats: one for being read by humans and other for being read by
machines. Some other Git commands also have two output formats, notably
git-config which was the inspiration for the two formats that were
chosen here:

- keyvalue, where the retrieved data is printed one per line, using =
  for delimiting the key and the value. This is the default format,
  targeted for end users.
- nul, where the retrieved data is separated by NUL characters, using
  the newline character for delimiting the key and the value. This
  format is targeted for being read by machines.

Helped-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Justin Tobler <jltobler@gmail.com>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Mentored-by: Karthik Nayak <karthik.188@gmail.com>
Mentored-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agorepo: add the field layout.shallow
Lucas Seiki Oshiro [Sat, 16 Aug 2025 22:46:02 +0000 (19:46 -0300)] 
repo: add the field layout.shallow

This commit is part of the series that introduces the new subcommand
git-repo-info.

The flag `--is-shallow-repository` from git-rev-parse is used for
retrieving whether the repository is shallow. This way, it is used for
querying repository metadata, fitting in the purpose of git-repo-info.

Then, add a new field `layout.shallow` to the git-repo-info subcommand
containing that information.

Helped-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Justin Tobler <jltobler@gmail.com>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Mentored-by: Karthik Nayak <karthik.188@gmail.com>
Mentored-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agorepo: add the field layout.bare
Lucas Seiki Oshiro [Sat, 16 Aug 2025 22:46:01 +0000 (19:46 -0300)] 
repo: add the field layout.bare

This commit is part of the series that introduces the new subcommand
git-repo-info.

The flag --is-bare-repository from git-rev-parse is used for retrieving
whether the current repository is bare. This way, it is used for
querying repository metadata, fitting in the purpose of git-repo-info.

Then, add a new field layout.bare to the git-repo-info subcommand
containing that information.

Helped-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Justin Tobler <jltobler@gmail.com>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Mentored-by: Karthik Nayak <karthik.188@gmail.com>
Mentored-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agorepo: add the field references.format
Lucas Seiki Oshiro [Sat, 16 Aug 2025 22:46:00 +0000 (19:46 -0300)] 
repo: add the field references.format

This commit is part of the series that introduces the new subcommand
git-repo-info.

The flag `--show-ref-format` from git-rev-parse is used for retrieving
the reference format (i.e. `files` or `reftable`). This way, it is
used for querying repository metadata, fitting in the purpose of
git-repo-info.

Add a new field `references.format` to the repo-info subcommand
containing that information.

Helped-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Justin Tobler <jltobler@gmail.com>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Mentored-by: Karthik Nayak <karthik.188@gmail.com>
Mentored-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agorepo: declare the repo command
Lucas Seiki Oshiro [Sat, 16 Aug 2025 22:45:59 +0000 (19:45 -0300)] 
repo: declare the repo command

Currently, `git rev-parse` covers a wide range of functionality not
directly related to parsing revisions, as its name suggests. Over time,
many features like parsing datestrings, options, paths, and others
were added to it because there wasn't a more appropriate command
to place them.

Create a new Git command called `repo`. `git repo` will be the main
command for obtaining the information about a repository (such as
metadata and metrics).

Also declare a subcommand for `repo` called `info`. `git repo info`
will bring the functionality of retrieving repository-related
information currently returned by `rev-parse`.

Add the required documentation and build changes to enable usage of
this subcommand.

Helped-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Justin Tobler <jltobler@gmail.com>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Mentored-by: Karthik Nayak <karthik.188@gmail.com>
Mentored-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agocmake: accommodate for `UNIT_TEST_SOURCES`
Johannes Schindelin [Sun, 3 Aug 2025 21:24:26 +0000 (21:24 +0000)] 
cmake: accommodate for `UNIT_TEST_SOURCES`

As part of 9bbc981c6f2 (t/unit-tests: finalize migration of
reftable-related tests, 2025-07-24), the explicit list of
`UNIT_TEST_PROGRAMS` was turned into a wildcard pattern-derived list.

Let's do the same in the CMake definition.

This fixes build errors with symptoms like this:

  CMake Error at CMakeLists.txt:132 (string):
    string sub-command REPLACE requires at least four arguments.
  Call Stack (most recent call first):
    CMakeLists.txt:1037 (parse_makefile_for_scripts)

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agot/t1517: mark tests that fail with GIT_TEST_INSTALLED
Adam Dinwoodie [Sat, 16 Aug 2025 10:36:53 +0000 (11:36 +0100)] 
t/t1517: mark tests that fail with GIT_TEST_INSTALLED

The changes added by 39fc408562 (t/t1517: automate `git subcmd -h` tests
outside a repository, 2025-08-08) to automatically loop over all "main"
Git commands will, when run against an installed build using
GIT_TEST_INSTALLED rather than the build in the build directory, include
some extra git-gui commands that are installed by `make install`.  These
fail the test, so record them as such.

Signed-off-by: Adam Dinwoodie <adam@dinwoodie.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agol10n: Update Catalan Translation for Git 2.51-rc2
Mikel Forcada [Fri, 15 Aug 2025 20:40:41 +0000 (22:40 +0200)] 
l10n: Update Catalan Translation for Git 2.51-rc2

Edit: We are continuing to follow the existing PO file convention, which
includes filenames but strips out line numbers from the file-location
comments. This standard was set by our former lead, Jordi Mas, and we
are maintaining it for project-wide consistency.

Signed-off-by: Mikel Forcada <mikel.forcada@gmail.com>
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2 months agoMerge branch 'jx/zh_CN-2.51' of github.com:jiangxin/git
Jiang Xin [Sun, 17 Aug 2025 12:48:50 +0000 (08:48 -0400)] 
Merge branch 'jx/zh_CN-2.51' of github.com:jiangxin/git

* 'jx/zh_CN-2.51' of github.com:jiangxin/git:
  l10n: zh_CN: updated translation for 2.51

2 months agol10n: zh_CN: updated translation for 2.51
Teng Long [Fri, 15 Aug 2025 07:27:51 +0000 (15:27 +0800)] 
l10n: zh_CN: updated translation for 2.51

Signed-off-by: Teng Long <dyroneteng@gmail.com>
Reviewed-by: Fangyi Zhou <me@fangyi.io>
Reviewed-by: 依云 <lilydjwg@gmail.com>
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2 months agoMerge branch '2.51-uk-update' of github.com:arkid15r/git-ukrainian-l10n
Jiang Xin [Sun, 17 Aug 2025 00:22:55 +0000 (20:22 -0400)] 
Merge branch '2.51-uk-update' of github.com:arkid15r/git-ukrainian-l10n

* '2.51-uk-update' of github.com:arkid15r/git-ukrainian-l10n:
  l10n: uk: add 2.51 translation

2 months agol10n: uk: add 2.51 translation
Arkadii Yakovets [Sat, 16 Aug 2025 15:40:52 +0000 (08:40 -0700)] 
l10n: uk: add 2.51 translation

Co-authored-by: Kate Golovanova <kate@kgthreads.com>
Signed-off-by: Arkadii Yakovets <ark@cho.red>
Signed-off-by: Kate Golovanova <kate@kgthreads.com>
2 months agoMerge branch 'fr_v2.51.0' of github.com:jnavila/git
Jiang Xin [Sat, 16 Aug 2025 05:52:32 +0000 (01:52 -0400)] 
Merge branch 'fr_v2.51.0' of github.com:jnavila/git

* 'fr_v2.51.0' of github.com:jnavila/git:
  l10n: fr translation update for v2.51.0

2 months agoMerge branch 'po-id' of github.com:bagasme/git-po
Jiang Xin [Sat, 16 Aug 2025 05:51:25 +0000 (01:51 -0400)] 
Merge branch 'po-id' of github.com:bagasme/git-po

* 'po-id' of github.com:bagasme/git-po:
  l10n: po-id for 2.51

2 months agoMerge branch 'tr-l10n' of github.com:bitigchi/git-po
Jiang Xin [Sat, 16 Aug 2025 05:50:53 +0000 (01:50 -0400)] 
Merge branch 'tr-l10n' of github.com:bitigchi/git-po

* 'tr-l10n' of github.com:bitigchi/git-po:
  l10n: tr: Update Turkish translations for 2.51.0

2 months agoMerge branch 'l10n/zh-TW/2025-08-08' of github.com:l10n-tw/git-po
Jiang Xin [Sat, 16 Aug 2025 05:50:04 +0000 (01:50 -0400)] 
Merge branch 'l10n/zh-TW/2025-08-08' of github.com:l10n-tw/git-po

* 'l10n/zh-TW/2025-08-08' of github.com:l10n-tw/git-po:
  l10n: zh_TW: Git 2.51

2 months agoMerge branch 'master' of github.com:alshopov/git-po
Jiang Xin [Sat, 16 Aug 2025 05:47:43 +0000 (01:47 -0400)] 
Merge branch 'master' of github.com:alshopov/git-po

* 'master' of github.com:alshopov/git-po:
  l10n: bg.po: Updated Bulgarian translation (5856t)

2 months agoMerge branch 'master' of github.com:nafmo/git-l10n-sv
Jiang Xin [Sat, 16 Aug 2025 05:47:04 +0000 (01:47 -0400)] 
Merge branch 'master' of github.com:nafmo/git-l10n-sv

* 'master' of github.com:nafmo/git-l10n-sv:
  l10n: sv.po: Update Swedish translation

2 months agoMerge branch 'vi-2.51' of github.com:Nekosha/git-po
Jiang Xin [Sat, 16 Aug 2025 05:43:07 +0000 (01:43 -0400)] 
Merge branch 'vi-2.51' of github.com:Nekosha/git-po

* 'vi-2.51' of github.com:Nekosha/git-po:
  l10n: Updated translation for vi-2.51

2 months agol10n: zh_TW: Git 2.51
Yi-Jyun Pan [Sat, 9 Aug 2025 02:46:50 +0000 (10:46 +0800)] 
l10n: zh_TW: Git 2.51

Co-authored-by: Lumynous <lumynou5.tw@gmail.com>
Co-authored-by: hms5232 <hms5232@hhming.moe>
Signed-off-by: Yi-Jyun Pan <pan93412@gmail.com>
2 months agoMerge branch 'tc/diff-tree-max-depth' into next
Junio C Hamano [Fri, 15 Aug 2025 22:02:44 +0000 (15:02 -0700)] 
Merge branch 'tc/diff-tree-max-depth' into next

"git diff-tree" learned "--max-depth" option.

* tc/diff-tree-max-depth:
  diff: teach tree-diff a max-depth parameter
  within_depth: fix return for empty path
  combine-diff: zero memory used for callback filepairs

2 months agocommit-graph: stop passing in redundant repository
Patrick Steinhardt [Fri, 15 Aug 2025 05:49:52 +0000 (07:49 +0200)] 
commit-graph: stop passing in redundant repository

Many of the commit-graph related functions take in both a repository and
the object database source (directly or via `struct commit_graph`) for
which we are supposed to load such a commit-graph. In the best case this
information is simply redundant as the source already contains a
reference to its owning object database, which in turn has a reference
to its repository. In the worst case this information could even
mismatch when passing in a source that doesn't belong to the same
repository.

Refactor the code so that we only pass in the object database source in
those cases.

There is one exception though, namely `load_commit_graph_chain_fd_st()`,
which is responsible for loading a commit-graph chain. It is expected
that parts of the commit-graph chain aren't located in the same object
source as the chain file itself, but in a different one. Consequently,
this function doesn't work on the source level but on the database level
instead.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agocommit-graph: stop using `the_repository`
Patrick Steinhardt [Fri, 15 Aug 2025 05:49:51 +0000 (07:49 +0200)] 
commit-graph: stop using `the_repository`

There's still a bunch of uses of `the_repository` in "commit-graph.c",
which we want to stop using due to it being a global variable. Refactor
the code to stop using `the_repository` in favor of the repository
provided via the calling context.

This allows us to drop the `USE_THE_REPOSITORY_VARIABLE` macro.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agocommit-graph: stop using `the_hash_algo`
Patrick Steinhardt [Fri, 15 Aug 2025 05:49:50 +0000 (07:49 +0200)] 
commit-graph: stop using `the_hash_algo`

Stop using `the_hash_algo` as it implicitly relies on `the_repository`.
Instead, we either use the hash algo provided via the context or, if
there is no such hash algo, we use `the_repository` explicitly. Such
uses will be removed in subsequent commits.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agocommit-graph: refactor `parse_commit_graph()` to take a repository
Patrick Steinhardt [Fri, 15 Aug 2025 05:49:49 +0000 (07:49 +0200)] 
commit-graph: refactor `parse_commit_graph()` to take a repository

Refactor `parse_commit_graph()` so that it takes a repository instead of
taking repository settings. On the one hand this allows us to get rid of
instances where we access `the_hash_algo` by using the repository's hash
algorithm instead. On the other hand it also allows us to move the call
of `prepare_repo_settings()` into the function itself.

Note that there's one small catch, as the commit-graph fuzzer calls this
function directly without having a fully functional repository at hand.
And while the fuzzer already initializes `the_repository` with relevant
info, the call to `prepare_repo_settings()` would fail because we don't
have a fully-initialized repository.

Work around the issue by also settings `settings.initialized` to pretend
that we've already read the settings.

While at it, remove the redundant `parse_commit_graph()` declaration in
the fuzzer. It was added together with aa658574bf (commit-graph, fuzz:
add fuzzer for commit-graph, 2019-01-15), but as we also declared the
same function in "commit-graph.h" it wasn't ever needed.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agocommit-graph: store the hash algorithm instead of its length
Patrick Steinhardt [Fri, 15 Aug 2025 05:49:48 +0000 (07:49 +0200)] 
commit-graph: store the hash algorithm instead of its length

The commit-graph stores the length of the hash algorithm it uses. In
subsequent commits we'll need to pass the whole hash algorithm around
though, which we currently don't have access to.

Refactor the code so that we store the hash algorithm instead of only
its size.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agocommit-graph: stop using `the_hash_algo` via macros
Patrick Steinhardt [Fri, 15 Aug 2025 05:49:47 +0000 (07:49 +0200)] 
commit-graph: stop using `the_hash_algo` via macros

We have two macros `GRAPH_DATA_WIDTH` and `GRAPH_MIN_SIZE` that compute
hash-dependent sizes. They do so by using the global `the_hash_algo`
variable though, which we want to get rid of over time.

Convert these macros into functions that accept the hash algorithm as
input parameter. Adapt callers accordingly.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agol10n: po-id for 2.51
Bagas Sanjaya [Fri, 8 Aug 2025 10:11:35 +0000 (17:11 +0700)] 
l10n: po-id for 2.51

Update following components:

  * add-interactive.c
  * builtin/add.c
  * builtin/config.c
  * builtin/fetch.c
  * builtin/for-each-ref.c
  * builtin/gc.c
  * builtin/merge.c
  * builtin/pack-objects.c
  * builtin/remote.c
  * builtin/repack.c
  * builtin/stash.c
  * builtin/submodule--helper.c
  * diff-no-index.c
  * git-send-email.perl
  * imap-send.c
  * parse-options.c
  * refs.c
  * t/helper/test-path-walk.c
  * usage.c

Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
2 months agol10n: fr translation update for v2.51.0
Jean-Noël Avila [Fri, 8 Aug 2025 20:49:35 +0000 (22:49 +0200)] 
l10n: fr translation update for v2.51.0

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
2 months agocount-objects: document count-objects pack
Daniele Sassoli [Thu, 14 Aug 2025 14:33:54 +0000 (14:33 +0000)] 
count-objects: document count-objects pack

0bdaa12169b (git-count-objects.txt: describe each line in -v output,
2013-02-08) forgot to include `packs`.

Signed-off-by: Daniele Sassoli <danielesassoli@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agol10n: tr: Update Turkish translations for 2.51.0
Emir SARI [Thu, 7 Aug 2025 19:02:09 +0000 (22:02 +0300)] 
l10n: tr: Update Turkish translations for 2.51.0

Signed-off-by: Emir SARI <emir_sari@icloud.com>
2 months agol10n: Updated translation for vi-2.51
Vũ Tiến Hưng [Thu, 14 Aug 2025 09:28:09 +0000 (16:28 +0700)] 
l10n: Updated translation for vi-2.51

Signed-off-by: Vũ Tiến Hưng <newcomerminecraft@gmail.com>
2 months agol10n: sv.po: Update Swedish translation
Peter Krefting [Thu, 14 Aug 2025 08:54:03 +0000 (09:54 +0100)] 
l10n: sv.po: Update Swedish translation

Also fix typo reported by Tuomas Ahola <taahol@utu.fi>.

Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
2 months agoMerge branch 'ly/diff-name-only-with-diff-from-content' into next
Junio C Hamano [Wed, 13 Aug 2025 22:54:59 +0000 (15:54 -0700)] 
Merge branch 'ly/diff-name-only-with-diff-from-content' into next

Various options to "git diff" that makes comparison ignore certain
aspects of the differences (like "space changes are ignored",
"differences in lines that match these regular expressions are
ignored") did not work well with "--name-only" and friends.

* ly/diff-name-only-with-diff-from-content:
  diff: ensure consistent diff behavior with ignore options

2 months agoMerge branch 'dk/help-all' into next
Junio C Hamano [Wed, 13 Aug 2025 22:54:58 +0000 (15:54 -0700)] 
Merge branch 'dk/help-all' into next

"git cmd --help-all" outside repository.

* dk/help-all:
  builtin: also setup gently for --help-all
  parse-options: refactor flags for usage_with_options_internal

2 months agol10n: bg.po: Updated Bulgarian translation (5856t)
Alexander Shopov [Wed, 6 Aug 2025 10:06:00 +0000 (12:06 +0200)] 
l10n: bg.po: Updated Bulgarian translation (5856t)

Signed-off-by: Alexander Shopov <ash@kambanaria.org>
2 months agot7005: sanitize test environment for subsequent tests
D. Ben Knoble [Wed, 13 Aug 2025 17:50:05 +0000 (13:50 -0400)] 
t7005: sanitize test environment for subsequent tests

Some of the editor tests manipulate the environment or config in ways
that affect future tests, but those modifications are visible to future
tests and create a footgun for them.

Use test_config, subshells, single-command environment overrides, and
test helpers to automatically undo environment and config modifications
once finished.

Best-viewed-with: --ignore-all-space
Signed-off-by: D. Ben Knoble <ben.knoble+github@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agot7005: stop abusing --exec-path
D. Ben Knoble [Wed, 13 Aug 2025 17:50:04 +0000 (13:50 -0400)] 
t7005: stop abusing --exec-path

We want the editors in this test on PATH, so put them there.

Signed-off-by: D. Ben Knoble <ben.knoble+github@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agot7005: use modern test style
D. Ben Knoble [Wed, 13 Aug 2025 17:50:03 +0000 (13:50 -0400)] 
t7005: use modern test style

Tests in t7005 mask Git error codes and do not use our nice test
helpers. Improve that, move some code into the setup test, and drop a
few old-style blank lines while at it.

Best-viewed-with: --ignore-all-space
Signed-off-by: D. Ben Knoble <ben.knoble+github@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoSync with Git 2.51-rc2
Junio C Hamano [Wed, 13 Aug 2025 15:07:05 +0000 (08:07 -0700)] 
Sync with Git 2.51-rc2
Git 2.51-rc2

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEE4fA2sf7nIh/HeOzvsLXohpav5ssFAmicqB8ACgkQsLXohpav
# 5svRORAA8TGwqcaq4RjCgnsmnlT1m/CdqkLq6v9P571hRDIBB8Hk35Yb7LMxQ6CN
# vvxFaGmP25lMw82xNmRtN2yqTJFN3a0Z+kcnzfeGv+Zg5ifNNjqnpBz/QUkC4VwE
# imv5JvJEDzATl/ovxfJB1+6PrC29kayLqqtx3e8ZxsvA7T1e1KYa8W8LVFxC2eJJ
# cm0V9W27+Mh85FLQUc0y8yQhJc4z5bcJJYnggpus99+Mik4uCFKpEnBDQcbZ8yNX
# FcYNaJHW0gBn/O5M/3gHdJjFQGF/A0pJDbzr6OtNFoMjrjSDwQd1DJ5A6e89A8FP
# vrMCW0Ar15ObwuH5HxOa8Vi73IwT+lJhxD8NgmJMJEWxqia71e0GouO2vpxJPQ7g
# UCi85Y2raA5Cih3WbpEMN3W2ARohVvaxBytKZND0kcUK9hz/SnBSYddh1l0rR1yo
# ADyiAT4893J37bNoH4ChnUZ9eE0BTVrzdRpWTKkM0G++A1RqjQJic62ppPTocMOO
# vnxzkoYN30dTdHlBJ160IiPvlk8ONVOsPDToN0mjd0v2dZz6u1GepkAH3SArzsau
# KGhGwyrqj7+/cbALeFAGRdiFWyVzGdCkCq/D7zz8Q1dJM/e1l+VO2U+UiD4wYhqy
# S90g0aPa15CskT7uBmLUajU/6YnbyETgDVnvs7/IL7f34Wfhlyc=
# =8Sly
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 13 Aug 2025 07:58:39 AM PDT
# gpg:                using RSA key E1F036B1FEE7221FC778ECEFB0B5E88696AFE6CB
# gpg: Good signature from "Junio C Hamano <gitster@pobox.com>" [ultimate]
# gpg:                 aka "Junio C Hamano <junio@pobox.com>" [ultimate]
# gpg:                 aka "Junio C Hamano <jch@google.com>" [ultimate]

* tag 'v2.51.0-rc2':
  Git 2.51-rc2

2 months agoMerge branch 'kr/clone-synopsis-fix' into next
Junio C Hamano [Wed, 13 Aug 2025 15:06:50 +0000 (08:06 -0700)] 
Merge branch 'kr/clone-synopsis-fix' into next

Doc fix.

* kr/clone-synopsis-fix:
  docs: remove stray bracket from git-clone synopsis

2 months agoMerge branch 'ac/deglobal-fmt-merge-log-config' into next
Junio C Hamano [Wed, 13 Aug 2025 15:06:49 +0000 (08:06 -0700)] 
Merge branch 'ac/deglobal-fmt-merge-log-config' into next

Code clean-up.

* ac/deglobal-fmt-merge-log-config:
  builtin/fmt-merge-msg: stop depending on 'the_repository'
  environment: remove the global variable 'merge_log_config'

2 months agoMerge branch 'jc/diff-no-index-in-subdir' into next
Junio C Hamano [Wed, 13 Aug 2025 15:06:49 +0000 (08:06 -0700)] 
Merge branch 'jc/diff-no-index-in-subdir' into next

"git diff --no-index" run inside a subdirectory under control of a
Git repository operated at the top of the working tree and stripped
the prefix from the output, and oddballs like "-" (stdin) did not
work correctly because of it.  Correct the set-up by undoing what
the set-up sequence did to cwd and prefix.

* jc/diff-no-index-in-subdir:
  diff: --no-index should ignore the worktree

2 months agoMerge branch 'gh/git-jump-pathname-with-sp' into next
Junio C Hamano [Wed, 13 Aug 2025 15:06:48 +0000 (08:06 -0700)] 
Merge branch 'gh/git-jump-pathname-with-sp' into next

"git jump" (in contrib/) fails to parse the diff header correctly
when a file has a space in its name, which has been corrected.

* gh/git-jump-pathname-with-sp:
  git-jump: make `diff` work with filenames containing spaces

2 months agoMerge branch 'ms/refs-list' into next
Junio C Hamano [Wed, 13 Aug 2025 15:06:48 +0000 (08:06 -0700)] 
Merge branch 'ms/refs-list' into next

The "list" subcommand of "git refs" acts as a front-end for
"git for-each-ref".

* ms/refs-list:
  t: add test for git refs list subcommand
  t6300: refactor tests to be shareable
  builtin/refs: add list subcommand
  builtin/for-each-ref: factor out core logic into a helper
  builtin/for-each-ref: align usage string with the man page
  doc: factor out common option

2 months agoGit 2.51-rc2 v2.51.0-rc2
Junio C Hamano [Wed, 13 Aug 2025 14:57:49 +0000 (07:57 -0700)] 
Git 2.51-rc2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoMerge branch 'ly/changed-path-traversal-with-magic-pathspec' into next
Junio C Hamano [Tue, 12 Aug 2025 21:18:32 +0000 (14:18 -0700)] 
Merge branch 'ly/changed-path-traversal-with-magic-pathspec' into next

Revision traversal limited with pathspec, like "git log dir/*",
used to ignore changed-paths Bloom filter when the pathspec
contained wildcards; now they take advantage of the filter when
they can.

* ly/changed-path-traversal-with-magic-pathspec:
  bloom: enable bloom filter with wildcard pathspec in revision traversal

2 months agoMerge branch 'en/ort-rename-fixes' into next
Junio C Hamano [Tue, 12 Aug 2025 21:18:32 +0000 (14:18 -0700)] 
Merge branch 'en/ort-rename-fixes' into next

Various bugs about rename handling in "ort" merge strategy have
been fixed.

* en/ort-rename-fixes:
  merge-ort: fix directory rename on top of source of other rename/delete
  merge-ort: fix incorrect file handling
  merge-ort: clarify the interning of strings in opt->priv->path
  t6423: fix missed staging of file in testcases 12i,12j,12k
  t6423: document two bugs with rename-to-self testcases
  merge-ort: drop unnecessary temporary in check_for_directory_rename()
  merge-ort: update comments to modern testfile location

2 months agoMerge branch 'ua/t1517-short-help-tests' into next
Junio C Hamano [Tue, 12 Aug 2025 21:18:31 +0000 (14:18 -0700)] 
Merge branch 'ua/t1517-short-help-tests' into next

Test shuffling.

* ua/t1517-short-help-tests:
  t5304: move `prune -h` test from t1517
  t5200: move `update-server-info -h` test from t1517
  t/t1517: automate `git subcmd -h` tests outside a repository

2 months agoMerge branch 'rj/t6137-cygwin-fix' into next
Junio C Hamano [Tue, 12 Aug 2025 21:18:31 +0000 (14:18 -0700)] 
Merge branch 'rj/t6137-cygwin-fix' into next

Test fix for breakage introduced in Git 2.50.

* rj/t6137-cygwin-fix:
  t6137-*.sh: fix test failure on cygwin

2 months agoMerge branch 'kh/doc-git-log-markup-fix' into next
Junio C Hamano [Tue, 12 Aug 2025 21:18:31 +0000 (14:18 -0700)] 
Merge branch 'kh/doc-git-log-markup-fix' into next

Doc update.

* kh/doc-git-log-markup-fix:
  doc: git-log: fix description list

2 months agodocs: remove stray bracket from git-clone synopsis
Knut Harald Ryager [Mon, 11 Aug 2025 22:04:32 +0000 (22:04 +0000)] 
docs: remove stray bracket from git-clone synopsis

The synopsis section has an extra closing bracket, like this:

    [--filter=<filter>] [--also-filter-submodules]]

The extra one is not the one at the end of this line; it is the one
after "...=<filter>".

The "--also-filter-submodules" option was added by f05da2b4 (clone,
submodule: pass partial clone filters to submodules, 2022-02-04).
Because it makes sense only when used with the "--filter=<filter>"
option, these two options are enclosed in a pair of brackets.  The
extra one was added by 76880f05 (doc: git-clone: apply new
documentation formatting guidelines, 2024-03-29) by mistake.

Remove the extra and incorrect closing bracket, so that the line
reads:

    [--filter=<filter> [--also-filter-submodules]]

Signed-off-by: Knut Harald Ryager <e-k-nut@hotmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agorefs/reftable: always reload stacks when creating lock
Patrick Steinhardt [Tue, 12 Aug 2025 09:54:22 +0000 (11:54 +0200)] 
refs/reftable: always reload stacks when creating lock

When creating a new addition via either `reftable_stack_new_addition()`
or its convenince wrapper `reftable_stack_add()` we:

  1. Create the "tables.list.lock" file.

  2. Verify that the current version of the "tables.list" file is
     up-to-date.

  3. Write the new table records if so.

By default, the second step would cause us to bail out if we see that
there has been a concurrent write to the stack that made our in-memory
copy of the stack out-of-date. This is a safety mechanism to not write
records to the stack based on outdated information.

The downside though is that concurrent writes may now cause us to bail
out, which is not a good user experience. In addition, this isn't even
necessary for us, as Git knows to perform all checks for the old state
of references under the lock. (Well, in all except one case: when we
expire the reflog we first create the log iterator before we create the
lock, but this ordering is fixed as part of this commit.)

Consequently, most writers pass the `REFTABLE_STACK_NEW_ADDITION_RELOAD`
flag. The effect of this flag is that we reload the stack after having
acquired the lock in case the stack is out-of-date. This plugs the race
with concurrent writers, but we continue performing the verifications of
the expected old state to catch actual conflicts in the references we
are about to write.

Adapt the remaining callsites that don't yet pass this flag to do so.
While at it, drop a needless manual reload.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoreftable: don't second-guess errors from flock interface
Patrick Steinhardt [Tue, 12 Aug 2025 09:54:21 +0000 (11:54 +0200)] 
reftable: don't second-guess errors from flock interface

The `flock` interface is implemented as part of "reftable/system.c" and
thus needs to be implemented by the integrator between the reftable
library and its parent code base. As such, we cannot rely on any
specific implementation thereof.

Regardless of that, users of the `flock` subsystem rely on `errno` being
set to specific values. This is fragile and not documented anywhere and
doesn't really make for a good interface.

Refactor the code so that the implementations themselves are expected to
return reftable-specific error codes. Our implementation of the `flock`
subsystem already knows to do this for all error paths except one.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoreftable/stack: handle outdated stacks when compacting
Patrick Steinhardt [Tue, 12 Aug 2025 09:54:20 +0000 (11:54 +0200)] 
reftable/stack: handle outdated stacks when compacting

When we compact the reftable stack we first acquire the lock for the
"tables.list" file and then reload the stack to check that it is still
up-to-date. This is done by calling `stack_uptodate()`, which knows to
return zero in case the stack is up-to-date, a positive value if it is
not and a negative error code on unexpected conditions.

We don't do proper error checking though, but instead we only check
whether the returned error code is non-zero. If so, we simply bubble it
up the calling stack, which means that callers may see an unexpected
positive value.

Fix this issue by translating to `REFTABLE_OUTDATED_ERROR` instead.
Handle this situation in `reftable_addition_commit()`, where we perform
a best-effort auto-compaction.

All other callsites of `stack_uptodate()` know to handle a positive
return value and thus don't need to be fixed.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoreftable/stack: allow passing flags to `reftable_stack_add()`
Patrick Steinhardt [Tue, 12 Aug 2025 09:54:19 +0000 (11:54 +0200)] 
reftable/stack: allow passing flags to `reftable_stack_add()`

The `reftable_stack_add()` function is a simple wrapper to lock the
stack, add records to it via a callback and then commit the
result. One problem with it though is that it doesn't accept any flags
for creating the addition. This makes it impossible to automatically
reload the stack in case it was modified before we managed to lock the
stack.

Add a `flags` field to plug this gap and pass it through accordingly.
For now this new flag won't be used by us, but it will be used by
libgit2.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoreftable/stack: fix compiler warning due to missing braces
Patrick Steinhardt [Tue, 12 Aug 2025 09:54:18 +0000 (11:54 +0200)] 
reftable/stack: fix compiler warning due to missing braces

While perfectly legal, older compiler toolchains complain when
zero-initializing structs that contain nested structs with `{0}`:

    /home/libgit2/source/deps/reftable/stack.c:862:35: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
            struct reftable_addition empty = REFTABLE_ADDITION_INIT;
                                             ^~~~~~~~~~~~~~~~~~~~~~
    /home/libgit2/source/deps/reftable/stack.c:707:33: note: expanded from macro 'REFTABLE_ADDITION_INIT'
    #define REFTABLE_ADDITION_INIT {0}
                                    ^

We had the discussion around whether or not we want to handle such bogus
compiler errors in the past already [1]. Back then we basically decided
that we do not care about such old-and-buggy compilers, so while we
could fix the issue by using `{{0}}` instead this is not the preferred
way to handle this in the Git codebase.

We have an easier fix though: we can just drop the macro altogether and
handle initialization of the struct in `reftable_stack_addition_init()`.
Callers are expected to call this function already, so this change even
simplifies the calling convention.

[1]: https://lore.kernel.org/git/20220710081135.74964-1-sunshine@sunshineco.com/T/

Suggested-by: Carlo Arenas <carenas@gmail.com>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoreftable/stack: reorder code to avoid forward declarations
Patrick Steinhardt [Tue, 12 Aug 2025 09:54:17 +0000 (11:54 +0200)] 
reftable/stack: reorder code to avoid forward declarations

We have a couple of forward declarations in the stack-related code of
the reftable library. These declarations aren't really required, but are
simply caused by unfortunate ordering.

Reorder the code and remove the forward declarations.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoreftable/writer: drop Git-specific `QSORT()` macro
Patrick Steinhardt [Tue, 12 Aug 2025 09:54:16 +0000 (11:54 +0200)] 
reftable/writer: drop Git-specific `QSORT()` macro

The reftable writer accidentally uses the Git-specific `QSORT()` macro.
This macro removes the need for the caller to provide the element size,
but other than that it's mostly equivalent to `qsort()`.

Replace the macro accordingly to make the library usable outside of Git.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoreftable/writer: fix type used for number of records
Patrick Steinhardt [Tue, 12 Aug 2025 09:54:15 +0000 (11:54 +0200)] 
reftable/writer: fix type used for number of records

Both `reftable_writer_add_refs()` and `reftable_writer_add_logs()`
accept an array of records that should be added to the new table.
Callers of this function are expected to also pass the number of such
records to the function to tell it how many such records it is supposed
to write.

But while all callers pass in a `size_t`, which is a sensible choice,
the function in fact accepts an `int` as argument, which is less so. Fix
this.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoSync with 'master'
Junio C Hamano [Tue, 12 Aug 2025 04:31:16 +0000 (21:31 -0700)] 
Sync with 'master'

2 months agoMerge branch 'dl/push-missing-object-error' into next
Junio C Hamano [Tue, 12 Aug 2025 04:31:01 +0000 (21:31 -0700)] 
Merge branch 'dl/push-missing-object-error' into next

"git push" had a code path that led to BUG() but it should have
been a die(), as it is a response to a usual but invalid end-user
action to attempt pushing an object that does not exist.

* dl/push-missing-object-error:
  remote.c: convert if-else ladder to switch
  remote.c: remove BUG in show_push_unqualified_ref_name_error()
  t5516: remove surrounding empty lines in test bodies

2 months agoMerge branch 'jc/strbuf-split' into next
Junio C Hamano [Tue, 12 Aug 2025 04:31:00 +0000 (21:31 -0700)] 
Merge branch 'jc/strbuf-split' into next

Arrays of strbuf is often a wrong data structure to use, and
strbuf_split*() family of functions that create them often have
better alternatives.

Update several code paths and replace strbuf_split*().

* jc/strbuf-split:
  trace2: do not use strbuf_split*()
  trace2: trim_trailing_newline followed by trim is a no-op
  sub-process: do not use strbuf_split*()
  environment: do not use strbuf_split*()
  config: do not use strbuf_split()
  notes: do not use strbuf_split*()
  merge-tree: do not use strbuf_split*()
  clean: do not use strbuf_split*() [part 2]
  clean: do not pass the whole structure when it is not necessary
  clean: do not use strbuf_split*() [part 1]
  clean: do not pass strbuf by value
  wt-status: avoid strbuf_split*()

2 months agoMerge branch 'jc/string-list-split' into next
Junio C Hamano [Tue, 12 Aug 2025 04:31:00 +0000 (21:31 -0700)] 
Merge branch 'jc/string-list-split' into next

string_list_split*() family of functions have been extended to
simplify common use cases.

* jc/string-list-split:
  string-list: split-then-remove-empty can be done while splitting
  string-list: optionally omit empty string pieces in string_list_split*()
  diff: simplify parsing of diff.colormovedws
  string-list: optionally trim string pieces split by string_list_split*()
  string-list: unify string_list_split* functions
  string-list: align string_list_split() with its _in_place() counterpart
  string-list: report programming error with BUG

2 months agoA few hotfixes before -rc2
Junio C Hamano [Tue, 12 Aug 2025 04:29:57 +0000 (21:29 -0700)] 
A few hotfixes before -rc2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoMerge branch 'rs/merge-compact-summary'
Junio C Hamano [Tue, 12 Aug 2025 04:30:16 +0000 (21:30 -0700)] 
Merge branch 'rs/merge-compact-summary'

Hotfix.

* rs/merge-compact-summary:
  merge: don't document non-existing --compact-summary argument

2 months agoMerge branch 'rs/for-each-ref-start-after-marker-fix'
Junio C Hamano [Tue, 12 Aug 2025 04:30:15 +0000 (21:30 -0700)] 
Merge branch 'rs/for-each-ref-start-after-marker-fix'

Hotfix.

* rs/for-each-ref-start-after-marker-fix:
  for-each-ref: call --start-after argument "marker"

2 months agodoc lint: check that synopsis manpages have synopsis inlines
Jean-Noël Avila [Mon, 11 Aug 2025 20:53:20 +0000 (20:53 +0000)] 
doc lint: check that synopsis manpages have synopsis inlines

When switching manpages to the synopsis style, the description lists of
options need to be switched to inline synopsis for proper formatting. This
is done by enclosing the option name in double backticks, e.g. `--option`.

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agodoc:git-for-each-ref: fix styling and typos
Jean-Noël Avila [Mon, 11 Aug 2025 20:53:19 +0000 (20:53 +0000)] 
doc:git-for-each-ref: fix styling and typos

This commit fixes the synopsis syntax and changes the wording of a few
descriptions to be more consistent with the rest of the documentation.

It is a prepartion for the next commit that checks that synopsis style is
applied consistently across a manual page.

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agodoc: check for absence of the form --[no-]parameter
Jean-Noël Avila [Mon, 11 Aug 2025 20:53:18 +0000 (20:53 +0000)] 
doc: check for absence of the form --[no-]parameter

For better searchability, this commit adds a check to ensure that parameters
expressed in the form of `--[no-]parameter` are not used in the
documentation.  In the place of such parameters, the documentation should
list two separate parameters: `--parameter` and `--no-parameter`.

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agodoc: check for absence of multiple terms in each entry of desc list
Jean-Noël Avila [Mon, 11 Aug 2025 20:53:17 +0000 (20:53 +0000)] 
doc: check for absence of multiple terms in each entry of desc list

For simplifying automated translation of the documentation, it is better to
only present one term in each entry of a description list of options. This
is because most of these terms can automatically be marked as
notranslatable.

Also, due to portability issues, the script generate-configlist.sh can no
longer insert newlines in the output. However, the result is that it no
longer correctly handles multiple terms in a single entry of definition
lists.

As a result, we now check that these entries do not exist in the
documentation.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>