Commit Graph

78817 Commits

Author SHA1 Message Date
Patrick Steinhardt
f905a855b1 packfile: move the MRU list into the packfile store
Packfiles have two lists associated to them:

  - A list that keeps track of packfiles in the order that they were
    added to a packfile store.

  - A list that keeps track of packfiles in most-recently-used order so
    that packfiles that are more likely to contain a specific object are
    ordered towards the front.

Both of these lists are hosted by `struct packed_git` itself, So to
identify all packfiles in a repository you simply need to grab the first
packfile and then iterate the `->next` pointers or the MRU list. This
pattern has the problem that all packfiles are part of the same list,
regardless of whether or not they belong to the same object source.

With the upcoming pluggable object database effort this needs to change:
packfiles should be contained by a single object source, and reading an
object from any such packfile should use that source to look up the
object. Consequently, we need to break up the global lists of packfiles
into per-object-source lists.

A first step towards this goal is to move those lists out of `struct
packed_git` and into the packfile store. While the packfile store is
currently sitting on the `struct object_database` level, the intent is
to push it down one level into the `struct odb_source` in a subsequent
patch series.

Introduce a new `struct packfile_list` that is used to manage lists of
packfiles and use it to store the list of most-recently-used packfiles
in `struct packfile_store`. For now, the new list type is only used in a
single spot, but we'll expand its usage in subsequent patches.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-10-30 07:09:52 -07:00
Patrick Steinhardt
e78ab37054 packfile: use a strmap to store packs by name
To allow fast lookups of a packfile by name we use a hashmap that has
the packfile name as key and the pack itself as value. But while this is
the perfect use case for a `strmap`, we instead use `struct hashmap` and
store the hashmap entry in the packfile itself.

Simplify the code by using a `strmap` instead.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-10-30 07:09:52 -07:00
Junio C Hamano
ed3305fff7 Merge branch 'ps/remove-packfile-store-get-packs' into ps/packed-git-in-object-store
* ps/remove-packfile-store-get-packs: (55 commits)
  packfile: rename `packfile_store_get_all_packs()`
  packfile: introduce macro to iterate through packs
  packfile: drop `packfile_store_get_packs()`
  builtin/grep: simplify how we preload packs
  builtin/gc: convert to use `packfile_store_get_all_packs()`
  object-name: convert to use `packfile_store_get_all_packs()`
  builtin/repack.c: clean up unused `#include`s
  repack: move `write_cruft_pack()` out of the builtin
  repack: move `write_filtered_pack()` out of the builtin
  repack: move `pack_kept_objects` to `struct pack_objects_args`
  repack: move `finish_pack_objects_cmd()` out of the builtin
  builtin/repack.c: pass `write_pack_opts` to `finish_pack_objects_cmd()`
  repack: extract `write_pack_opts_is_local()`
  repack: move `find_pack_prefix()` out of the builtin
  builtin/repack.c: use `write_pack_opts` within `write_cruft_pack()`
  builtin/repack.c: introduce `struct write_pack_opts`
  repack: 'write_midx_included_packs' API from the builtin
  builtin/repack.c: inline packs within `write_midx_included_packs()`
  builtin/repack.c: pass `repack_write_midx_opts` to `midx_included_packs`
  builtin/repack.c: inline `remove_redundant_bitmaps()`
  ...
2025-10-28 10:00:56 -07:00
Junio C Hamano
419c72cb8a Sync with Git 2.51.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-10-26 20:09:24 -07:00
Junio C Hamano
bb5c624209 Git 2.51.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
v2.51.2
2025-10-26 19:48:21 -07:00
Junio C Hamano
b42b995d22 Merge branch 'so/t2401-use-test-path-helpers' into maint-2.51
Test modernization.

* so/t2401-use-test-path-helpers:
  t2401: update path checks using test_path helpers
2025-10-26 19:48:21 -07:00
Junio C Hamano
476b2407be Merge branch 'js/ci-github-actions-update' into maint-2.51
CI update.

* js/ci-github-actions-update:
  build(deps): bump actions/github-script from 7 to 8
  build(deps): bump actions/setup-python from 5 to 6
  build(deps): bump actions/checkout from 4 to 5
  build(deps): bump actions/download-artifact from 4 to 5
2025-10-26 19:48:20 -07:00
Junio C Hamano
3b9055c369 Merge branch 'kh/doc-continued-paragraph-fix' into maint-2.51
Doc mark-up fixes.

* kh/doc-continued-paragraph-fix:
  doc: fix accidental literal blocks
2025-10-26 19:48:20 -07:00
Junio C Hamano
4b67e53fd6 Merge branch 'js/unreachable-workaround-for-no-symlink-head' into maint-2.51
Code clean-up.

* js/unreachable-workaround-for-no-symlink-head:
  refs: forbid clang to complain about unreachable code
2025-10-26 19:48:20 -07:00
Junio C Hamano
ed931ebe18 Merge branch 'ps/t7528-ssh-agent-uds-workaround' into maint-2.51
Recent OpenSSH creates the Unix domain socket to communicate with
ssh-agent under $HOME instead of /tmp, which causes our test to
fail doe to overly long pathname in our test environment, which has
been worked around by using "ssh-agent -T".

* ps/t7528-ssh-agent-uds-workaround:
  t7528: work around ETOOMANY in OpenSSH 10.1 and newer
2025-10-26 19:48:20 -07:00
Junio C Hamano
2ad0fc2add Merge branch 'tb/unicode-width-table-17' into maint-2.51
Unicode width table update.

* tb/unicode-width-table-17:
  unicode: update the width tables to Unicode 17
2025-10-26 19:48:19 -07:00
Junio C Hamano
3d638cb389 Merge branch 'jk/status-z-short-fix' into maint-2.51
The "--short" option of "git status" that meant output for humans
and "-z" option to show NUL delimited output format did not mix
well, and colored some but not all things.  The command has been
updated to color all elements consistently in such a case.

* jk/status-z-short-fix:
  status: make coloring of "-z --short" consistent
2025-10-26 19:48:19 -07:00
Junio C Hamano
2319fbae48 Merge branch 'jk/diff-no-index-with-pathspec-fix' into maint-2.51
An earlier addition to "git diff --no-index A B" to limit the
output with pathspec after the two directories misbehaved when
these directories were given with a trailing slash, which has been
corrected.

* jk/diff-no-index-with-pathspec-fix:
  diff --no-index: fix logic for paths ending in '/'
2025-10-26 19:48:19 -07:00
Junio C Hamano
70b475f938 Merge branch 'ps/gitlab-ci-disable-windows-monitoring' into maint-2.51
Windows "real-time monitoring" interferes with the execution of
tests and affects negatively in both correctness and performance,
which has been disabled in Gitlab CI.

* ps/gitlab-ci-disable-windows-monitoring:
  gitlab-ci: disable realtime monitoring to unbreak Windows jobs
2025-10-26 19:48:19 -07:00
Junio C Hamano
306eb9ae56 Merge branch 'jc/diff-from-contents-fix' into maint-2.51
The code to squelch output from "git diff -w --name-status"
etc. for paths that "git diff -w -p" would have stayed silent
leaked output from dry-run patch generation, which has been
corrected.

* jc/diff-from-contents-fix:
  diff: make sure the other caller of diff_flush_patch_quietly() is silent
2025-10-26 19:48:18 -07:00
Junio C Hamano
e56c419347 Merge branch 'jk/diff-from-contents-fix' into maint-2.51
Recently we attempted to improve "git diff -w" and friends to
handle cases where patch output would be suppressed, but it
introduced a bug that emits unnecessary output, which has been
corrected.

* jk/diff-from-contents-fix:
  diff: restore redirection to /dev/null for diff_from_contents
2025-10-26 19:48:18 -07:00
Junio C Hamano
4e98b730f1 The twenty-fourth batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-10-24 13:48:05 -07:00
Junio C Hamano
52b56e8b79 Merge branch 'ps/t7528-ssh-agent-uds-workaround'
Recent OpenSSH creates the Unix domain socket to communicate with
ssh-agent under $HOME instead of /tmp, which causes our test to
fail doe to overly long pathname in our test environment, which has
been worked around by using "ssh-agent -T".

* ps/t7528-ssh-agent-uds-workaround:
  t7528: work around ETOOMANY in OpenSSH 10.1 and newer
2025-10-24 13:48:05 -07:00
Junio C Hamano
7d763b98ef Merge branch 'rs/add-patch-document-p-for-pager'
Show 'P'ipe command in "git add -p".

* rs/add-patch-document-p-for-pager:
  add-patch: fully document option P
2025-10-24 13:48:05 -07:00
Junio C Hamano
78bf9ce0d1 Merge branch 'jc/t1016-setup-fix'
GPG signing test set-up has been broken for a year, which has been
corrected.

* jc/t1016-setup-fix:
  t1016: make sure to use specified GPG
2025-10-24 13:48:05 -07:00
Junio C Hamano
503789c250 Merge branch 'tb/unicode-width-table-17'
Unicode width table update.

* tb/unicode-width-table-17:
  unicode: update the width tables to Unicode 17
2025-10-24 13:48:04 -07:00
Junio C Hamano
42737585fa Merge branch 'tu/credential-makefile-updates'
Build procedure for a few credential helpers (in contrib/) have
been updated.

* tu/credential-makefile-updates:
  contrib/credential: harmonize Makefiles
2025-10-24 13:48:04 -07:00
Junio C Hamano
e7909b3a90 Merge branch 'jk/status-z-short-fix'
The "--short" option of "git status" that meant output for humans
and "-z" option to show NUL delimited output format did not mix
well, and colored some but not all things.  The command has been
updated to color all elements consistently in such a case.

* jk/status-z-short-fix:
  status: make coloring of "-z --short" consistent
2025-10-24 13:48:04 -07:00
Junio C Hamano
385772e183 Merge branch 'js/t7500-pwd-windows-fix'
Test fix.

* js/t7500-pwd-windows-fix:
  t7500: fix tests with absolute path following ":(optional)" on Windows
2025-10-24 13:48:04 -07:00
Junio C Hamano
411903ce4c Merge branch 'rj/doc-technical-fixes'
Documentation mark-up fixes.

* rj/doc-technical-fixes:
  doc: add large-object-promisors.adoc to the docs build
  doc: commit-graph.adoc: fix up some formatting
  doc: sparse-checkout.adoc: fix asciidoc warnings
  doc: remembering-renames.adoc: fix asciidoc warnings
2025-10-24 13:48:04 -07:00
Junio C Hamano
1d10771264 The twenty-third batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-10-24 09:13:52 -07:00
Junio C Hamano
5139fce01f Merge branch 'jc/diff-from-contents-fix'
The code to squelch output from "git diff -w --name-status"
etc. for paths that "git diff -w -p" would have stayed silent
leaked output from dry-run patch generation, which has been
corrected.

* jc/diff-from-contents-fix:
  diff: make sure the other caller of diff_flush_patch_quietly() is silent
2025-10-24 09:10:37 -07:00
Junio C Hamano
88b3704ab1 Merge branch 'jk/diff-from-contents-fix'
Recently we attempted to improve "git diff -w" and friends to
handle cases where patch output would be suppressed, but it
introduced a bug that emits unnecessary output, which has been
corrected.

* jk/diff-from-contents-fix:
  diff: restore redirection to /dev/null for diff_from_contents
2025-10-24 09:10:37 -07:00
Patrick Steinhardt
b7fb2194b9 t7528: work around ETOOMANY in OpenSSH 10.1 and newer
In t7528 we spawn an SSH agent to verify that we can sign a commit via
it. This test has started to fail on some machines:

    +++ ssh-agent
    unix_listener_tmp: path "/home/pks/Development/git/build/test-output/trash directory.t7528-signed-commit-ssh/.ssh/agent/s.UTulegefEg.agent.UrPHumMXPq" too long for Unix domain socket
    main: Couldn't prepare agent socket

As it turns out this is caused by a change in OpenSSH 10.1 [1]:

 * ssh-agent(1), sshd(8): move agent listener sockets from /tmp to
   under ~/.ssh/agent for both ssh-agent(1) and forwarded sockets
   in sshd(8).

Instead of creating the socket in "/tmp", OpenSSH now creates the socket
in our home directory. And as the home directory gets modified to be
located in our test output directory we end up with paths that are
somewhat long. But Linux has a rather short limit of 108 characters for
socket paths, and other systems have even lower limits, so it is very
easy now to exceed the limit and run into the above error.

Work around the issue by using `ssh-agent -T`, which instructs it to
use the old behaviour and create the socket in "/tmp" again. This switch
has only been introduced with 10.1 though, so for older versions we have
to fall back to not using it. That's fine though, as older versions know
to put the socket into "/tmp" already.

An alternative approach would be to abbreviate the socket name itself so
that we create it as e.g. "sshsock" in the trash directory. But taking
the above example we'd still end up with a path that is 91 characters
long. So we wouldn't really have a lot of headroom, and it is quite
likely that some developers would see the issue on their machines.

[1]: https://www.openssh.com/txt/release-10.1

Reported-by: Xi Ruoyao <xry111@xry111.site>
Suggested-by: brian m. carlson <sandals@crustytoothpaste.net>
Helped-by: Jeff King <peff@peff.net>
Helped-by: Lauri Tirkkonen <lauri@hacktheplanet.fi>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-10-23 09:52:55 -07:00
Junio C Hamano
3da4413dbc diff: make sure the other caller of diff_flush_patch_quietly() is silent
Earlier, we added is a protection for the loop that computes "git
diff --quiet -w" to ensure calls to the diff_flush_patch_quietly()
helper stays quiet.  Do the same for another loop that deals with
options like "--name-status" to make calls to the same helper.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-10-23 09:05:28 -07:00
Junio C Hamano
c54a18ef67 The twenty-second batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-10-22 11:38:59 -07:00
Junio C Hamano
f3fac332c0 Merge branch 'so/t2401-use-test-path-helpers'
Test modernization.

* so/t2401-use-test-path-helpers:
  t2401: update path checks using test_path helpers
2025-10-22 11:38:58 -07:00
Junio C Hamano
0e746434e8 Merge branch 'je/doc-pull'
Documentation updates.

* je/doc-pull:
  doc: git-pull: clarify how to exit a conflicted merge
  doc: git-pull: delete the example
  doc: git-pull: clarify options for integrating remote branch
  doc: git-pull: move <repository> and <refspec> params
2025-10-22 11:38:58 -07:00
Junio C Hamano
98401c10fc Merge branch 'bc/sha1-256-interop-01'
The beginning of SHA1-SHA256 interoperability work.

* bc/sha1-256-interop-01:
  t1010: use BROKEN_OBJECTS prerequisite
  t: allow specifying compatibility hash
  fsck: consider gpgsig headers expected in tags
  rev-parse: allow printing compatibility hash
  docs: add documentation for loose objects
  docs: improve ambiguous areas of pack format documentation
  docs: reflect actual double signature for tags
  docs: update offset order for pack index v3
  docs: update pack index v3 format
2025-10-22 11:38:58 -07:00
Junio C Hamano
c9ccf81948 Merge branch 'js/ci-github-actions-update'
CI update.

* js/ci-github-actions-update:
  build(deps): bump actions/github-script from 7 to 8
  build(deps): bump actions/setup-python from 5 to 6
  build(deps): bump actions/checkout from 4 to 5
  build(deps): bump actions/download-artifact from 4 to 5
2025-10-22 11:38:58 -07:00
René Scharfe
301e20da20 add-patch: fully document option P
Show option P in the prompt and explain it properly on a dedicated line
in online help and documentation.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-10-21 14:35:44 -07:00
Torsten Bögershausen
330a54099e unicode: update the width tables to Unicode 17
Unicode 17 is out. Update the unicode with table.

https://blog.unicode.org/2025/09/unicode-170-release-announcement.html
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-10-21 10:03:00 -07:00
Junio C Hamano
133d151831 The twenty-first batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-10-20 14:12:18 -07:00
Junio C Hamano
8329f6724b Merge branch 'tb/cat-file-objectmode-update'
Code clean-up.

* tb/cat-file-objectmode-update:
  builtin/cat-file.c: simplify calling `report_object_status()`
2025-10-20 14:12:18 -07:00
Junio C Hamano
a23c82509f Merge branch 'kh/doc-continued-paragraph-fix'
Doc mark-up fixes.

* kh/doc-continued-paragraph-fix:
  doc: fix accidental literal blocks
2025-10-20 14:12:17 -07:00
Junio C Hamano
5a34f66fb9 Merge branch 'js/unreachable-workaround-for-no-symlink-head'
Code clean-up.

* js/unreachable-workaround-for-no-symlink-head:
  refs: forbid clang to complain about unreachable code
2025-10-20 14:12:17 -07:00
Junio C Hamano
fc00bf0f9c Merge branch 'js/mingw-includes-cleanup'
Code clean-up.

* js/mingw-includes-cleanup:
  mingw: order `#include`s alphabetically
  mingw: avoid relative `#include`s
2025-10-20 14:12:17 -07:00
Junio C Hamano
29b0700515 Merge branch 'dk/stash-apply-index'
Doc update.

* dk/stash-apply-index:
  doc: explain the impact of stash.index on --autostash options
2025-10-20 14:12:17 -07:00
Thomas Uhle
9b8ff6dc9a contrib/credential: harmonize Makefiles
Update these Makefiles to be in line with other Makefiles from contrib
such as for contacts or subtree by making the following changes:

* Make the default settings after including config.mak.autogen and
  config.mak.
* Add the missing $(CPPFLAGS) to the compiler command as well as the
  missing $(CFLAGS) to the linker command.
* Use a pattern rule for compilation instead of a dedicated rule for
  each compile unit.
* Get rid of $(MAIN), $(SRCS) and $(OBJS) and simply use their values
  such as git-credential-libsecret and git-credential-libsecret.o.
* Strip @ from $(RM) to let the clean target rule be verbose.
* Define .PHONY for all special targets (all, clean).

Signed-off-by: Thomas Uhle <thomas.uhle@mailbox.tu-dresden.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-10-20 12:34:57 -07:00
Johannes Sixt
91e6a645e7 t7500: fix tests with absolute path following ":(optional)" on Windows
On Windows, the MSYS layer translates absolute path names generated by
a shell script from the POSIX style /c/dir/file to the Windows style
C:/dir/file form that is understood by git.exe. This happens only when
the absolute path stands on its own as a program argument or a value of
an environment variable.

The earlier commits 749d6d166d (config: values of pathname type can be
prefixed with :(optional), 2025-09-28) and ccfcaf399f (parseopt: values
of pathname type can be prefixed with :(optional), 2025-09-28) added
test cases where ":(optional)" is inserted before an absolute path.
$PWD is used to construct the absolute paths, which gives the POSIX
form, and the result is ":(optional)/c/dir/template". Such command line
arguments are no longer recognized as absolute paths and do not undergo
translation.

Existing test cases that expect that the specified file does not exist
are not incorrect (after all, git.exe will not find /c/dir/template).
Yet, they are conceptually incorrect. That the use of $PWD is erroneous
is revealed by a test case that expects that the optional file exists.
Since no such test case is present, add one. Use "$(pwd)" to generate
the absolute paths, so that the command line arguments become
":(optional)C:/dir/template".

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-10-20 09:16:49 -07:00
Jeff King
50927f4f68 status: make coloring of "-z --short" consistent
When running "git status -z --short", the marker on modified index
entries (e.g., "M") is colorized, but the "??" marker for untracked
entries is not. Let's fix the "??" entries to show color here.

At first glance you might think that neither should be colorized, as
usually one would use "-z" to get machine-readable output. But this is a
tricky and unusual case. We have two output formats, "--short" and
"--porcelain" which are substantially similar, but differ in that
"--short" is for humans who want something short and "--porcelain" is
for machines. And "-z" by itself, without any other output option, does
default to "--porcelain", so "git status -z" will not colorize anything.

But if you explicitly ask for "-z" and "--short" together, then that is
asking for the human-readable output, but separated by NULs. This is
unlikely to be useful directly, but could for example be used if the
output will be shown to a human outside of the terminal. At any rate,
the current behavior is clearly wrong (since we colorize some things but
not others), and I think colorizing everything is the least-surprising
thing we can do here.

Reported-by: Langbart <Langbart@protonmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-10-17 14:30:42 -07:00
Junio C Hamano
f229982df1 The twentieth batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-10-17 14:02:17 -07:00
Junio C Hamano
e0fe91489f Merge branch 'jk/diff-no-index-with-pathspec-fix'
An earlier addition to "git diff --no-index A B" to limit the
output with pathspec after the two directories misbehaved when
these directories were given with a trailing slash, which has been
corrected.

* jk/diff-no-index-with-pathspec-fix:
  diff --no-index: fix logic for paths ending in '/'
2025-10-17 14:02:17 -07:00
Junio C Hamano
ab447045ed Merge branch 'tb/doc-submitting-patches'
A few more things that patch authors can do to help maintainer to
keep track of their topics better.

* tb/doc-submitting-patches:
  SubmittingPatches: guidance for multi-series efforts
  SubmittingPatches: extend release-notes experiment to topic names
2025-10-17 14:02:17 -07:00
Junio C Hamano
cd6c082b44 Merge branch 'rs/add-patch-options-fix'
The code in "git add -p" and friends to iterate over hunks was
riddled with bugs, which has been corrected.

* rs/add-patch-options-fix:
  add-patch: reset "permitted" at loop start
  add-patch: let options a and d roll over like y and n
  add-patch: let options k and K roll over like j and J
  add-patch: let options y, n, j, and e roll over to next undecided
  add-patch: document that option J rolls over
  add-patch: improve help for options j, J, k, and K
2025-10-17 14:02:17 -07:00