]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
9 hours agoMerge branch 'ps/commit-graph-per-object-source' into seen
Junio C Hamano [Sun, 5 Oct 2025 22:04:28 +0000 (15:04 -0700)] 
Merge branch 'ps/commit-graph-per-object-source' into seen

Declare commit-graph is per object_source, which may not be a good idea.

* ps/commit-graph-per-object-source:
  commit-graph: pass graphs that are to be merged as parameter
  commit-graph: return commit graph from `repo_find_commit_pos_in_graph()`
  commit-graph: return the prepared commit graph from `prepare_commit_graph()`
  revision: drop explicit check for commit graph
  blame: drop explicit check for commit graph

9 hours agoMerge branch 'ps/history' into seen
Junio C Hamano [Sun, 5 Oct 2025 22:04:28 +0000 (15:04 -0700)] 
Merge branch 'ps/history' into seen

"git history" history rewriting UI.

* ps/history:
  builtin/history: implement "split" subcommand
  cache-tree: allow writing in-memory index as tree
  add-patch: add support for in-memory index patching
  add-patch: remove dependency on "add-interactive" subsystem
  add-patch: split out `struct interactive_options`
  add-patch: split out header from "add-interactive.h"
  builtin/history: implement "reword" subcommand
  builtin: add new "history" command
  replay: parse commits before dereferencing them
  replay: stop using `the_repository`
  replay: extract logic to pick commits
  wt-status: provide function to expose status for trees

9 hours agoMerge branch 'sa/replay-atomic-ref-updates' into seen
Junio C Hamano [Sun, 5 Oct 2025 22:04:27 +0000 (15:04 -0700)] 
Merge branch 'sa/replay-atomic-ref-updates' into seen

"git replay" (experimental) learned to perform ref updates itself
in a transaction by default, instead of emitting where each refs
should point at and leaving the actual update to another command.

Comments?

* sa/replay-atomic-ref-updates:
  replay: make atomic ref updates the default behavior

9 hours agoMerge branch 'bc/sha1-256-interop-01' into jch
Junio C Hamano [Sun, 5 Oct 2025 22:04:18 +0000 (15:04 -0700)] 
Merge branch 'bc/sha1-256-interop-01' into jch

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

9 hours agoMerge branch 'en/doc-merge-tree-describe-merge-base' into jch
Junio C Hamano [Sun, 5 Oct 2025 22:04:18 +0000 (15:04 -0700)] 
Merge branch 'en/doc-merge-tree-describe-merge-base' into jch

Clarify the "--merge-base" command line option in "git merge-tree".

* en/doc-merge-tree-describe-merge-base:
  Documentation/git-merge-tree.adoc: clarify the --merge-base option

9 hours agoMerge branch 'rj/doc-technical-fixes' into jch
Junio C Hamano [Sun, 5 Oct 2025 22:04:17 +0000 (15:04 -0700)] 
Merge branch 'rj/doc-technical-fixes' into jch

Documenation mark-up fixes.

Comments?

* rj/doc-technical-fixes:
  doc: commit-graph.adoc: fix up some formatting
  doc: sparse-checkout.adoc: fix asciidoc warnings
  doc: remembering-renames.adoc: fix asciidoc warnings

9 hours agoMerge branch 'cc/doc-submitting-patches-with-ai' into jch
Junio C Hamano [Sun, 5 Oct 2025 22:04:17 +0000 (15:04 -0700)] 
Merge branch 'cc/doc-submitting-patches-with-ai' into jch

AI guidelines.

* cc/doc-submitting-patches-with-ai:
  SubmittingPatches: add section about AI

9 hours agoMerge branch 'jc/optional-path' into jch
Junio C Hamano [Sun, 5 Oct 2025 22:04:17 +0000 (15:04 -0700)] 
Merge branch 'jc/optional-path' into jch

Configuration variables that take a pathname as a value
(e.g. blame.ignorerevsfile) can be marked as optional by prefixing
":(optoinal)" before its value.

Comments?

* jc/optional-path:
  parseopt: values of pathname type can be prefixed with :(optional)
  config: values of pathname type can be prefixed with :(optional)
  t7500: make each piece more independent

9 hours agoMerge branch 'rj/doc-missing-technical-docs' into jch
Junio C Hamano [Sun, 5 Oct 2025 22:04:17 +0000 (15:04 -0700)] 
Merge branch 'rj/doc-missing-technical-docs' into jch

Doc updates.

* rj/doc-missing-technical-docs:
  doc: add some missing technical documents

9 hours agoMerge branch 'jt/repo-stats' into jch
Junio C Hamano [Sun, 5 Oct 2025 22:04:17 +0000 (15:04 -0700)] 
Merge branch 'jt/repo-stats' into jch

"git repo stats", a new command.

Comments?

* jt/repo-stats:
  builtin/repo: add progress meter for stats
  builtin/repo: add keyvalue and nul format for stats
  builtin/repo: add object counts in stats output
  builtin/repo: introduce stats subcommand
  ref-filter: allow NULL filter pattern
  builtin/repo: rename repo_info() to cmd_repo_info()

9 hours agoMerge branch 'jk/diff-no-index-with-pathspec-fix' into jch
Junio C Hamano [Sun, 5 Oct 2025 22:04:16 +0000 (15:04 -0700)] 
Merge branch 'jk/diff-no-index-with-pathspec-fix' into jch

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 '/'

9 hours agoMerge branch 'je/doc-pull' into jch
Junio C Hamano [Sun, 5 Oct 2025 22:04:16 +0000 (15:04 -0700)] 
Merge branch 'je/doc-pull' into jch

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

9 hours agoMerge branch 'je/doc-push-upstream' into jch
Junio C Hamano [Sun, 5 Oct 2025 22:04:16 +0000 (15:04 -0700)] 
Merge branch 'je/doc-push-upstream' into jch

Documentation updates.

* je/doc-push-upstream:
  SQUASH???
  doc: git-push: add explanation of `git push origin main`
  doc: git-push: clarify "what to push"
  doc: git-push: clarify "where to push"
  doc: add an UPSTREAM BRANCHES section to pull/push/fetch
  doc: git-push: clarify intro

9 hours agoMerge branch 'kh/format-patch-range-diff-notes' into jch
Junio C Hamano [Sun, 5 Oct 2025 22:04:16 +0000 (15:04 -0700)] 
Merge branch 'kh/format-patch-range-diff-notes' into jch

"git format-patch --range-diff=... --notes=..." did not drive the
underlying range-diff with correct --notes parameter, ending up
comparing with different set of notes from its main patch output
you would get from "git format-patch --notes=..." for a singleton
patch.

* kh/format-patch-range-diff-notes:
  format-patch: handle range-diff on notes correctly for single patches
  revision: add rdiff_log_arg to rev_info
  range-diff: rename other_arg to log_arg

9 hours agoMerge branch 'kn/reftable-consistency-checks' into jch
Junio C Hamano [Sun, 5 Oct 2025 22:04:16 +0000 (15:04 -0700)] 
Merge branch 'kn/reftable-consistency-checks' into jch

The reftable backend learned to sanity check its on-disk data more
carefully.

Comments?

* kn/reftable-consistency-checks:
  refs/reftable: add fsck check for checking the table name
  reftable: add code to facilitate consistency checks
  fsck: order 'fsck_msg_type' alphabetically
  Documentation/fsck-msgids: remove duplicate msg id
  reftable: check for trailing newline in 'tables.list'
  refs: move consistency check msg to generic layer
  refs: remove unused headers

9 hours agoMerge branch 'en/xdiff-cleanup' into jch
Junio C Hamano [Sun, 5 Oct 2025 22:04:15 +0000 (15:04 -0700)] 
Merge branch 'en/xdiff-cleanup' into jch

A lot of code clean-up of xdiff.
Split out of a larger topic.

* en/xdiff-cleanup:
  xdiff: change type of xdfile_t.changed from char to bool
  xdiff: add macros DISCARD(0), KEEP(1), INVESTIGATE(2) in xprepare.c
  xdiff: rename rchg -> changed in xdfile_t
  xdiff: delete chastore from xdfile_t
  xdiff: delete fields ha, line, size in xdlclass_t in favor of an xrecord_t
  xdiff: delete redundant array xdfile_t.ha
  xdiff: delete struct diffdata_t
  xdiff: delete local variables that alias fields in xrecord_t
  xdiff: delete superfluous function xdl_get_rec() in xemit
  xdiff: delete unnecessary fields from xrecord_t and xdfile_t
  xdiff: delete local variables and initialize/free xdfile_t directly
  xdiff: delete static forward declarations in xprepare

9 hours agoMerge branch 'pw/add-p-hunk-splitting-fix' into jch
Junio C Hamano [Sun, 5 Oct 2025 22:04:15 +0000 (15:04 -0700)] 
Merge branch 'pw/add-p-hunk-splitting-fix' into jch

Marking a hunk 'selected' in "git add -p" and then splitting made
all the split pieces 'selected'; this has been changed to make them
all 'undecided', which gives better end-user experience.

* pw/add-p-hunk-splitting-fix:
  add-patch: update hunk splitability after editing
  add -p: mark split hunks as undecided

9 hours agoMerge branch 'sj/string-list' into jch
Junio C Hamano [Sun, 5 Oct 2025 22:04:15 +0000 (15:04 -0700)] 
Merge branch 'sj/string-list' into jch

The "string-list" API function to find where a given string would
be inserted got updated so that it can use unrealistically huge
array index that would only fit in size_t but not int or ssize_t
to achieve unstated goal.

* sj/string-list:
  refs: enable sign compare warnings check
  string-list: change "string_list_find_insert_index" return type to "size_t"
  string-list: replace negative index encoding with "exact_match" parameter
  string-list: use bool instead of int for "exact_match"

9 hours agoMerge branch 'kh/doc-patch-id-markup-fix' into jch
Junio C Hamano [Sun, 5 Oct 2025 22:04:15 +0000 (15:04 -0700)] 
Merge branch 'kh/doc-patch-id-markup-fix' into jch

Documenaotin mark-up fix.

* kh/doc-patch-id-markup-fix:
  doc: patch-id: fix accidental literal blocks

9 hours ago### match next
Junio C Hamano [Sun, 5 Oct 2025 22:04:15 +0000 (15:04 -0700)] 
### match next

9 hours agoMerge branch 'ps/gitlab-ci-windows-improvements' into jch
Junio C Hamano [Sun, 5 Oct 2025 22:04:15 +0000 (15:04 -0700)] 
Merge branch 'ps/gitlab-ci-windows-improvements' into jch

GitLab CI improvements.

* ps/gitlab-ci-windows-improvements:
  t8020: fix test failure due to indeterministic tag sorting
  gitlab-ci: upload Meson test logs as JUnit reports
  gitlab-ci: drop workaround for Python certificate store on Windows
  gitlab-ci: ignore failures to disable realtime monitoring
  gitlab-ci: dedup instructions to disable realtime monitoring

9 hours agoMerge branch 'ps/rust-balloon' into jch
Junio C Hamano [Sun, 5 Oct 2025 22:04:14 +0000 (15:04 -0700)] 
Merge branch 'ps/rust-balloon' into jch

Dip our toes a bit to (optionally) use Rust implemented helper
called from our C code.

* ps/rust-balloon:
  ci: enable Rust for breaking-changes jobs
  ci: convert "pedantic" job into full build with breaking changes
  BreakingChanges: announce Rust becoming mandatory
  varint: reimplement as test balloon for Rust
  varint: use explicit width for integers
  help: report on whether or not Rust is enabled
  Makefile: introduce infrastructure to build internal Rust library
  Makefile: reorder sources after includes
  meson: add infrastructure to build internal Rust library

9 hours agoMerge branch 'mh/doc-credential-url-prefix' into jch
Junio C Hamano [Sun, 5 Oct 2025 22:04:14 +0000 (15:04 -0700)] 
Merge branch 'mh/doc-credential-url-prefix' into jch

Doc update to describe a feature that has already been implemented.

* mh/doc-credential-url-prefix:
  docs/gitcredentials: describe URL prefix matching

9 hours agoMerge branch 'kn/ref-cache-seek-fix' into jch
Junio C Hamano [Sun, 5 Oct 2025 22:04:14 +0000 (15:04 -0700)] 
Merge branch 'kn/ref-cache-seek-fix' into jch

Fix handling of an empty subdirectory of .git/refs/ in the
ref-files backend.

* kn/ref-cache-seek-fix:
  refs/ref-cache: fix SEGFAULT when seeking in empty directories

9 hours agoMerge branch 'ml/reflog-write-committer-info-fix' into jch
Junio C Hamano [Sun, 5 Oct 2025 22:04:14 +0000 (15:04 -0700)] 
Merge branch 'ml/reflog-write-committer-info-fix' into jch

"git reflog write" did not honor the configured user.name/email
which has been corrected.

* ml/reflog-write-committer-info-fix:
  builtin/reflog: respect user config in "write" subcommand

9 hours agoMerge branch 'ja/doc-markup-attached-paragraph-fix' into jch
Junio C Hamano [Sun, 5 Oct 2025 22:04:14 +0000 (15:04 -0700)] 
Merge branch 'ja/doc-markup-attached-paragraph-fix' into jch

Documentation mark-up fix.

* ja/doc-markup-attached-paragraph-fix:
  doc: change the markup of paragraphs following a nested list item

9 hours agoMerge branch 'ps/odb-clean-stale-wrappers' into jch
Junio C Hamano [Sun, 5 Oct 2025 22:04:13 +0000 (15:04 -0700)] 
Merge branch 'ps/odb-clean-stale-wrappers' into jch

Code clean-up.

* ps/odb-clean-stale-wrappers:
  odb: drop deprecated wrapper functions

9 hours agoMerge branch 'js/curl-off-t-fixes' into jch
Junio C Hamano [Sun, 5 Oct 2025 22:04:13 +0000 (15:04 -0700)] 
Merge branch 'js/curl-off-t-fixes' into jch

A few places where an size_t value was cast to curl_off_t without
checking has been updated to use the existing helper function.

* js/curl-off-t-fixes:
  http-push: avoid new compile error
  imap-send: be more careful when casting to `curl_off_t`
  http: offer to cast `size_t` to `curl_off_t` safely

9 hours agoMerge branch 'jt/clang-format-foreach-wo-space-before-parenthesis' into jch
Junio C Hamano [Sun, 5 Oct 2025 22:04:13 +0000 (15:04 -0700)] 
Merge branch 'jt/clang-format-foreach-wo-space-before-parenthesis' into jch

Clang-format update to let our control macros formatted the way we
had them traditionally, e.g., "for_each_string_list_item()" without
space before the parentheses.

* jt/clang-format-foreach-wo-space-before-parenthesis:
  clang-format: exclude control macros from SpaceBeforeParens

9 hours agoMerge branch 'ps/packfile-store' into jch
Junio C Hamano [Sun, 5 Oct 2025 22:04:13 +0000 (15:04 -0700)] 
Merge branch 'ps/packfile-store' into jch

Code clean-up around the in-core list of all the pack files and
object database(s).

* ps/packfile-store:
  packfile: refactor `get_packed_git_mru()` to work on packfile store
  packfile: refactor `get_all_packs()` to work on packfile store
  packfile: refactor `get_packed_git()` to work on packfile store
  packfile: move `get_multi_pack_index()` into "midx.c"
  packfile: introduce function to load and add packfiles
  packfile: refactor `install_packed_git()` to work on packfile store
  packfile: split up responsibilities of `reprepare_packed_git()`
  packfile: refactor `prepare_packed_git()` to work on packfile store
  packfile: reorder functions to avoid function declaration
  odb: move kept cache into `struct packfile_store`
  odb: move MRU list of packfiles into `struct packfile_store`
  odb: move packfile map into `struct packfile_store`
  odb: move initialization bit into `struct packfile_store`
  odb: move list of packfiles into `struct packfile_store`
  packfile: introduce a new `struct packfile_store`

9 hours agoMerge branch 'je/doc-push' into jch
Junio C Hamano [Sun, 5 Oct 2025 22:04:12 +0000 (15:04 -0700)] 
Merge branch 'je/doc-push' into jch

Doc updates.

* je/doc-push:
  doc: git-push: rewrite refspec specification
  doc: git-push: create PUSH RULES section

9 hours agoMerge branch 'ds/sparse-checkout-clean' into jch
Junio C Hamano [Sun, 5 Oct 2025 22:04:12 +0000 (15:04 -0700)] 
Merge branch 'ds/sparse-checkout-clean' into jch

"git sparse-checkout" subcommand learned a new "clean" action to
prune otherwise unused working-tree files that are outside the
areas of interest.

* ds/sparse-checkout-clean:
  t: expand tests around sparse merges and clean
  sparse-index: point users to new 'clean' action
  sparse-checkout: add --verbose option to 'clean'
  dir: add generic "walk all files" helper
  sparse-checkout: match some 'clean' behavior
  sparse-checkout: add basics of 'clean' command
  sparse-checkout: remove use of the_repository

10 hours agoMerge branch 'master' of https://github.com/j6t/gitk main master
Junio C Hamano [Sun, 5 Oct 2025 20:32:47 +0000 (13:32 -0700)] 
Merge branch 'master' of https://github.com/j6t/gitk

* 'master' of https://github.com/j6t/gitk:
  gitk: set minimum size on configuration dialog
  gitk: separate code blocks for configuration dialog
  gitk: make configuration dialog resizing useful
  gitk: add theme selection to color configuration page
  gitk: add proc run_themeloader
  gitk: eliminate unused ui color variables
  gitk: eliminate Interface color option from gui
  gitk: use text labels for next/prev search buttons
  gitk: use text labels for commit ID buttons
  gitk: do not invoke tk_setPalette
  gitk: use config variables to define and load a theme
  gitk: make sha1but a ttk::button
  gitk: use themed spinboxes
  gitk: fix MacOS 10.14 "Mojave" crash on launch
  gitk: fix error when remote tracking branch is deleted

20 hours agoMerge branch 'ml/themes'
Johannes Sixt [Sun, 5 Oct 2025 11:09:49 +0000 (13:09 +0200)] 
Merge branch 'ml/themes'

* ml/themes:
  gitk: set minimum size on configuration dialog
  gitk: separate code blocks for configuration dialog
  gitk: make configuration dialog resizing useful
  gitk: add theme selection to color configuration page
  gitk: add proc run_themeloader
  gitk: eliminate unused ui color variables
  gitk: eliminate Interface color option from gui
  gitk: use text labels for next/prev search buttons
  gitk: use text labels for commit ID buttons
  gitk: do not invoke tk_setPalette
  gitk: use config variables to define and load a theme
  gitk: make sha1but a ttk::button
  gitk: use themed spinboxes

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
40 hours agogitk: set minimum size on configuration dialog
Mark Levedahl [Sat, 4 Oct 2025 13:57:18 +0000 (09:57 -0400)] 
gitk: set minimum size on configuration dialog

gitk sets no size limit on its configuration dialog, allowing the user
to collapse the window so almost nothing is visible. The geometry
manager sets an initial size so all the widgets are visible, though
ignores the potentially very long text in the entry widgets in doing so.
Let's use this initial size as the minimum. The size information is
computed in Tk's idle processing queue, so a wait is required.

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
40 hours agogitk: separate code blocks for configuration dialog
Mark Levedahl [Wed, 1 Oct 2025 03:28:36 +0000 (23:28 -0400)] 
gitk: separate code blocks for configuration dialog

gitk's configuration dialog uses a large number of widgets, and this
code is hard to read as there is no easily recognizable grouping or
breaks. Help this by adding space between items that occupy a single row
in the dialog.

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
40 hours agogitk: make configuration dialog resizing useful
Mark Levedahl [Tue, 30 Sep 2025 23:35:59 +0000 (19:35 -0400)] 
gitk: make configuration dialog resizing useful

gitk's configuration dialog can be resized, but this does not expand the
space allocated to any widgets. Some items may have long lines of text
that would be visible if the widgets expanded, but this does not happen.

The top-level container uses a two column grid and allocates any space
change equally to both columns.  However, the configuration pages are
contained in one cell so half the additional space is wasted if
expanding. Also, the individual configuration pages do not mark any
column or widgets to expand, so any additional space given is just used
as padding.

Collapse the top-level page to have one column, placing the "OK" and
"Cancel" buttons in a non-resizing frame in column 1 (this keeps the
buttons in constant geometry as the dialog is expanded). This makes all
additional space go to the configuration page.

Mark column 3 of the individual pages to get all additional space, and
mark the text widgets in that column so they will expand to use the
space. While we're at it, eliminate or simplify use of frames to contain
column 2 content, and harmonize the indents of that content.

prefspage_general adds a special "spacer" label in row 2, column 1, that
causes all of the subsequent rows with no column 1 content to indent,
and this carries over to the next notebook tab (prefspage_color) through
some undocumented feature. The fonts page has a different indent, again
for unknown reason. The documented approach would be to use -padx
explicitly on all the rows to set the indents.

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
41 hours agoMerge branch 'es/ignore-osascript-failure'
Johannes Sixt [Sat, 4 Oct 2025 13:36:42 +0000 (15:36 +0200)] 
Merge branch 'es/ignore-osascript-failure'

* es/ignore-osascript-failure:
  gitk: fix MacOS 10.14 "Mojave" crash on launch

41 hours agoMerge branch 'mr/sort-refs-by-type'
Johannes Sixt [Sat, 4 Oct 2025 13:36:12 +0000 (15:36 +0200)] 
Merge branch 'mr/sort-refs-by-type'

* mr/sort-refs-by-type:
  gitk: fix error when remote tracking branch is deleted

2 days agoxdiff: change type of xdfile_t.changed from char to bool
Ezekiel Newren [Fri, 26 Sep 2025 22:41:59 +0000 (22:41 +0000)] 
xdiff: change type of xdfile_t.changed from char to bool

The only values possible for 'changed' is 1 and 0, which exactly maps
to a bool type. It might not look like this because action1 and action2
(which use to be dis1, and dis2) were also of type char and were
assigned numerical values within a few lines of 'changed' (what used to
be rchg).

Using DISCARD/KEEP/INVESTIGATE for action1[i]/action2[j], and true/false
for changed[k] makes it clear to future readers that these are
logically separate concepts.

Best-viewed-with: --color-words
Signed-off-by: Ezekiel Newren <ezekielnewren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 days agoxdiff: add macros DISCARD(0), KEEP(1), INVESTIGATE(2) in xprepare.c
Ezekiel Newren [Fri, 26 Sep 2025 22:41:58 +0000 (22:41 +0000)] 
xdiff: add macros DISCARD(0), KEEP(1), INVESTIGATE(2) in xprepare.c

This commit is refactor-only; no behavior is changed. A future commit
will use bool literals for changed[i].

The functions xdl_clean_mmatch() and xdl_cleanup_records() will be
cleaned up more in a future patch series. The changes to
xdl_cleanup_records(), in this patch, are just to make it clear why
`char rchg` is refactored to `bool changed`.

Rename dis* to action* and replace literal numericals with macros.
The old names came from when dis* (which I think was short for discard)
was treated like a boolean, but over time it grew into a ternary state
machine. The result was confusing because dis* and rchg* both used 0/1
values with different meanings.

The new names and macros make the states explicit. nm is short for
number of matches, and mlim is a heuristic limit:

  nm == 0       -> action[i] = DISCARD     -> changed[i] = true
  0 < nm < mlim -> action[i] = KEEP        -> changed[i] = false
  nm >= mlim    -> action[i] = INVESTIGATE -> changed[i] = xdl_clean_mmatch()

When need_min is true, only DISCARD and KEEP occur because the limit
is effectively infinite.

Best-viewed-with: --color-words
Signed-off-by: Ezekiel Newren <ezekielnewren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 days agot1010: use BROKEN_OBJECTS prerequisite
brian m. carlson [Thu, 2 Oct 2025 22:38:55 +0000 (22:38 +0000)] 
t1010: use BROKEN_OBJECTS prerequisite

When hash compatibility mode is enabled, we cannot write broken objects
because they cannot be mapped into the other hash algorithm.  Use the
BROKEN_OBJECTS prerequisite to disable these tests and the writing of
broken objects in this mode.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 days agot: allow specifying compatibility hash
brian m. carlson [Thu, 2 Oct 2025 22:38:54 +0000 (22:38 +0000)] 
t: allow specifying compatibility hash

We want to specify a compatibility hash for testing interactions for
SHA-256 repositories where we have SHA-1 compatibility enabled.  Allow
the user to specify this scenario in the test suite by setting
GIT_TEST_DEFAULT_HASH to "sha256:sha1".

Note that this will get passed into GIT_DEFAULT_HASH, which Git itself
does not presently support.  However, we will support this in a future
commit.

Since we'll now want to know the value for a specific version, let's add
the ability to specify either the storage hash (in this case, SHA-256)
or the compatibility hash (SHA-1).  We use a different value for the
compatibility hash that will be enabled for all repositories
(test_repo_compat_hash_algo) versus the one that is used individually in
some tests (test_compat_hash_algo), since we want to still run those
individual tests without requiring that the testsuite be run fully in a
compatibility mode.

In some cases, we'll need to adjust our test suite to work in a proper
way with a compatibility hash.  For example, in such a case, we'll only
use pack index v3, since v1 and v2 lack support for multiple algorithms.
Since we won't want to write those older formats, we'll need to skip
tests that do so.  Let's add a COMPAT_HASH prerequisite for this
purpose.

Finally, in this scenario, we can no longer rely on having broken
objects work since we lack compatibility mappings to rewrite objects in
the repository.  Add a prerequisite, BROKEN_OBJECTS, that we define in
terms of COMPAT_HASH and checks to see if creating deliberately broken
objects is possible, so that we can disable these tests if not.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 days agofsck: consider gpgsig headers expected in tags
brian m. carlson [Thu, 2 Oct 2025 22:38:53 +0000 (22:38 +0000)] 
fsck: consider gpgsig headers expected in tags

When we're creating a tag, we want to make sure that gpgsig and
gpgsig-sha256 headers are allowed for the commit.  The default fsck
behavior is to ignore the fact that they're left over, but some of our
tests enable strict checking which flags them nonetheless.  Add
improved checking for these headers as well as documentation and several
tests.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 days agorev-parse: allow printing compatibility hash
brian m. carlson [Thu, 2 Oct 2025 22:38:52 +0000 (22:38 +0000)] 
rev-parse: allow printing compatibility hash

Right now, we have a way to print the storage hash, the input hash, and
the output hash, but we lack a way to print the compatibility hash.  Add
a new type to --show-object-format, compat, which prints this value.

If no compatibility hash exists, simply print a newline.  This is
important to allow users to use multiple options at once while still
getting unambiguous output.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 days agodocs: add documentation for loose objects
brian m. carlson [Thu, 2 Oct 2025 22:38:51 +0000 (22:38 +0000)] 
docs: add documentation for loose objects

We currently have no documentation for how loose objects are stored.
Let's add some here so it's easy for people to understand how they
work.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 days agodocs: improve ambiguous areas of pack format documentation
brian m. carlson [Thu, 2 Oct 2025 22:38:50 +0000 (22:38 +0000)] 
docs: improve ambiguous areas of pack format documentation

It is fair to say that our pack and indexing code is quite complex.
Contributors who wish to work on this code or implementors of other
implementations would benefit from clear, unambiguous documentation
about how our data formats are structured and encoded and what data is
used in the computation of certain values.  Unfortunately, some of this
data is missing, which leads to confusion and frustration.

Let's document some of this data to help clarify things.  Specify over
what data CRC32 values are computed and also note which CRC32 algorithm
is used, since Wikipedia mentions at least four 32-bit CRC algorithms
and notes that it's possible to use different bit orderings.

In addition, note how we encode objects in the pack.  One might be led
to believe that packed objects are always stored with the "<type>
<size>\0" prefix of loose objects, but that is not the case, although
for obvious reasons this data is included in the computation of the
object ID.  Explain why this is for the curious reader.

Finally, indicate what the size field of the packed object represents.
Otherwise, a reader might think that the size of a delta is the size of
the full object or that it might contain the offset or object ID,
neither of which are the case.  Explain clearly, however, that the
values represent uncompressed sizes to avoid confusion.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 days agodocs: reflect actual double signature for tags
brian m. carlson [Thu, 2 Oct 2025 22:38:49 +0000 (22:38 +0000)] 
docs: reflect actual double signature for tags

The documentation for the hash function transition reflects the original
design where the SHA-256 signature would always be placed in a header.
However, due to a missed patch in Git 2.29, we shipped SHA-256 support
such that the signature for the current algorithm is always an in-body
signature and the opposite algorithm is always in a header.  Since the
documentation is inaccurate, update it to reflect the correct
information.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 days agodocs: update offset order for pack index v3
brian m. carlson [Thu, 2 Oct 2025 22:38:48 +0000 (22:38 +0000)] 
docs: update offset order for pack index v3

The current design of pack index v3 has items in two different orders:
sorted shortened object ID order and pack order.  The shortened object
IDs and the pack index offset values are in the former order and
everything else is in the latter.

This, however, poses some problems.  We have many parts of the packfile
code that expect to find out data about an object knowing only its index
in pack order.  With the current design, to find the pack offset after
having looked up the index in pack order, we must then look up the full
object ID and use that to look up the shortened object ID to find the
pack offset, which is inconvenient, inefficient, and leads to poor cache
usage.

Instead, let's change the offset values to be looked up by pack order.
This works better because once we know the pack order offset, we can
find the full object name and its location in the pack with a simple
index into their respective tables.  This makes many operations much
more efficient, especially with the functions we already have, and it
avoids the need for the revindex with pack index v3.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 days agodocs: update pack index v3 format
brian m. carlson [Thu, 2 Oct 2025 22:38:47 +0000 (22:38 +0000)] 
docs: update pack index v3 format

Our current pack index v3 format uses 4-byte integers to find the
trailer of the file.  This effectively means that the file cannot be
much larger than 2^32.  While this might at first seem to be okay, we
expect that each object will have at least 64 bytes worth of data, which
means that no more than about 67 million objects can be stored.

Again, this might seem fine, but unfortunately, we know of many users
who attempt to create repos with extremely large numbers of commits to
get a "high score," and we've already seen repositories with at least 55
million commits.  In the interests of gracefully handling repositories
even for these well-intentioned but ultimately misguided users, let's
change these lengths to 8 bytes.

For the checksums at the end of the file, we're producing 32-byte
SHA-256 checksums because that's what we already do with pack index v2
and SHA-256.  Truncating SHA-256 doesn't pose any actual security
problems other than those related to the reduced size, but our pack
checksum must already be 32 bytes (since SHA-256 packs have 32-byte
checksums) and it simplifies the code to use the existing hashfile logic
for these cases for the index checksum as well.

In addition, even though we may not need cryptographic security for the
index checksum, we'd like to avoid arguments from auditors and such for
organizations that may have compliance or security requirements.  Using
the simple, boring choice of the full SHA-256 hash avoids all possible
discussion related to hash truncation and removes impediments for these
organizations.

Note that we do not yet have a pack index v3 implementation in Git, so
it should be fine to change this format.  However, such an
implementation has been written for future inclusion following this
format.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 days agoDocumentation/git-merge-tree.adoc: clarify the --merge-base option
Elijah Newren [Thu, 2 Oct 2025 22:34:47 +0000 (22:34 +0000)] 
Documentation/git-merge-tree.adoc: clarify the --merge-base option

The --merge-base option for merge-tree has a few slightly awkward
constructions or omissions:
  * Split the initial long sentence describing the option into two,
    making the instructions and the limitations clearer for readers.
  * Add context to the final sentence that might be obvious to some
    readers but isn't immediately obvious to all.
  * The discussion about lack of support for multiple merge bases
    simply leave folks wondering why that matters and could help or
    hurt.  Separate it out and add a brief explanation.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 days agodoc: commit-graph.adoc: fix up some formatting
Ramsay Jones [Thu, 2 Oct 2025 22:12:16 +0000 (23:12 +0100)] 
doc: commit-graph.adoc: fix up some formatting

The formatting markup syntax used in this document (markdown?) is not
interpreted correctly by asciidoc or asciidoctor. The main problem is
the use of a '## ' prefix markup for some sub-headings, along with the
use of '```' code markup and some missing literal blocks.

In order to improve the (html) document formatting:

  - replace the '## ' prefix sub-title syntax with the '~~' underlining
    syntax for the relevant sub-headings.
  - replace the '```' code markup, which causes asciidoc(tor) to simply
    remove the marked up text, with a literal block '----' markup.
  - the second ascii diagram, in the 'Merging commit-graph files'
    section, is not rendered correctly by asciidoctor (asciidoc is fine)
    so enclose it in a '....' block.

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 days agodoc: sparse-checkout.adoc: fix asciidoc warnings
Ramsay Jones [Thu, 2 Oct 2025 22:12:15 +0000 (23:12 +0100)] 
doc: sparse-checkout.adoc: fix asciidoc warnings

Both asciidoc and asciidoctor issue warnings about 'list item index:
expected n got n-1' for n=1->7 on lines 928, 931, 951, 974, 980, 1033
and 1049. In asciidoc, numbered lists must start at one, whereas this
file has a list starting at zero. Also, asciidoc and asciidoctor warn
about 'section title out of sequence: expected level 1, got level 2'
on line 17. (asciidoc only complains about the first instance of this,
while asciidoctor complains about them all, on lines 95, 258, 303, 316,
545, 612, 752, 824, 895, 923 and 1053). These warnings stem from the
section titles not being correctly nested within a document/chapter
title.

In order to address the first set of warnings, simply renumber the list
from one to severn, rather than zero to six. Fortunately, this does not
require altering additional text, since the enumeration of 'Known Bugs'
is not referred to anywhere else in the document.

In order to address the second set of warnings, change the section title
syntax from '=== title ===' to '== title ==', effectively reducing the
nesting level of the title by one. Also, some apparent (sub-)titles are
not marked up with sub-title syntax, so add some '=== ' prefix(s) to the
relevant headings.

In addition to the warnings, address some other formatting issues:

  - the use of heavily nested unordered lists is not reflected in the
    output (making the file totally unreadable) because each level of
    nesting requires a different syntax. (i.e. replace '*' with '**'
    for the second level, '*' with '***' for the third level, etc.)
  - make use of literal blocks and manual indentation to get asciidoc
    and asciidoctor to display even remotely similar output.
  - make use of labelled lists, in some places, to get a similar looking
    output to the input, for both asciidoc and asciidoctor.
  - replace the trailing space in: `git grep ${SEARCH_TERM} OLDREV `
    otherwise the entire line in which that appears is removed from
    the output.

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 days agodoc: remembering-renames.adoc: fix asciidoc warnings
Ramsay Jones [Thu, 2 Oct 2025 22:12:14 +0000 (23:12 +0100)] 
doc: remembering-renames.adoc: fix asciidoc warnings

Both asciidoc and ascidoctor issue warnings about 'list item index:
expected n got n-1' for n=1->9 on lines 13, 15, 17, 20, 23, 25, 29,
31 and 33. In asciidoc, numbered lists must start at one, whereas this
file has a list starting at zero. Also, asciidoc and asciidoctor warn
about 'section title out of sequence: expected level 1, got level 2'
on line 38. (asciidoc only complains about the first instance of this,
while asciidoctor complains about them all, on lines 94, 141, 142,
184, 185, 257, 288, 289, 290, 397, 424, 485, 486 and 487). These
warnings stem from the section titles not being correctly nested within
a document/chapter title.

In order to address the first set of warnings, simply renumber the list
from one to nine, rather than zero to eight. This also requires altering
the text which refers to the section numbers, including other section
titles.

In order to address the second set of warnings, change the section title
syntax from '=== title ===' to '== title ==', effectively reducing the
nesting level of the title by one. Also, some of the titles are given
over multiple lines (they are very long), with an title '===' prefix
on each line. This leads to them being treated as separate sections
with no body text (as you can see from the line numbers given for the
asciidoctor warnings, above). So, for these titles, turn them into a
single (long) line of text.

In addition to the warnings, address some other formatting issues:

  - the ascii branch diagrams didn't format correctly on asciidoctor
    so include them in a literal block.
  - several blocks of text were intended to be formatted 'as is' but
    were not included in a literal block.
  - in section 8, format the (A)->(D) in the text description as a
    literal with `` marks, since (C) is rendered as a copyright
    symbol in html otherwise.
  - in section 9, a sub-list of two items is not formatted as such.
    change the '*' introducer to '**' to correct the sub-list format.

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 days agodoc: add some missing technical documents
Ramsay Jones [Thu, 2 Oct 2025 22:12:13 +0000 (23:12 +0100)] 
doc: add some missing technical documents

Commit bcf7edee09 ("meson: generate articles", 2024-12-27) added the
generation of the 'howto' and 'technical' documents to the meson build.
At this time those documents had a '*.txt' file extension, but they were
renamed with an '*.adoc' extension by commit 1f010d6bdf ("doc: use .adoc
extension for AsciiDoc files", 2025-01-20), for the most part. For the
meson build, commit 87eccc3a81 ("meson: fix building technical and howto
docs", 2025-03-02) fixed the meson.build files, which had not been
updated when the files were renamed.

However, the 'Documentation/Makefile' has not been updated to include
all of the recently added technical documents. In particular, the
following are built by meson, but not by the Makefile:

    commit-graph.adoc
    directory-rename-detection.adoc
    packfile-uri.adoc
    remembering-renames.adoc
    repository-version.adoc
    rerere.adoc
    sparse-checkout.adoc
    sparse-index.adoc

In order to ensure that both build systems format the same technical
documents, add the above documents to the TECH_DOCS variable in the
Documentation/Makefile.

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 days agoThe fourteenth batch
Junio C Hamano [Thu, 2 Oct 2025 19:23:32 +0000 (12:23 -0700)] 
The fourteenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 days agoMerge branch 'kh/you-still-use-whatchanged-fix'
Junio C Hamano [Thu, 2 Oct 2025 19:26:12 +0000 (12:26 -0700)] 
Merge branch 'kh/you-still-use-whatchanged-fix'

The "do you still use it?" message given by a command that is
deeply deprecated and allow us to suggest alternatives has been
updated.

* kh/you-still-use-whatchanged-fix:
  BreakingChanges: remove claim about whatchanged reports
  whatchanged: remove not-even-shorter clause
  whatchanged: hint about git-log(1) and aliasing
  you-still-use-that??: help the user help themselves
  t0014: test shadowing of aliases for a sample of builtins
  git: allow alias-shadowing deprecated builtins
  git: move seen-alias bookkeeping into handle_alias(...)
  git: add `deprecated` category to --list-cmds
  Makefile: don’t add whatchanged after it has been removed

3 days agoMerge branch 'ps/meson-build-docs'
Junio C Hamano [Thu, 2 Oct 2025 19:26:12 +0000 (12:26 -0700)] 
Merge branch 'ps/meson-build-docs'

The build procedure based on meson learned a target to only build
documentation, similar to "make doc".

* ps/meson-build-docs:
  ci: don't compile whole project when testing docs with Meson
  meson: print docs backend as part of the summary
  meson: introduce a "docs" alias to compile documentation only

3 days agoMerge branch 'ps/config-get-color-fixes'
Junio C Hamano [Thu, 2 Oct 2025 19:26:12 +0000 (12:26 -0700)] 
Merge branch 'ps/config-get-color-fixes'

The use of "git config get" command to learn how ANSI color
sequence is for a particular type, e.g., "git config get
--type=color --default=reset no.such.thing", isn't very ergonomic.

* ps/config-get-color-fixes:
  builtin/config: do not spawn pager when printing color codes
  builtin/config: special-case retrieving colors without a key
  builtin/config: do not die in `get_color()`
  t1300: small style fixups
  t1300: write test expectations in the test's body

3 days agoMerge branch 'cc/fast-import-strip-signed-commits'
Junio C Hamano [Thu, 2 Oct 2025 19:26:12 +0000 (12:26 -0700)] 
Merge branch 'cc/fast-import-strip-signed-commits'

"git fast-import" learned that "--signed-commits=<how>" option that
corresponds to that of "git fast-export".

* cc/fast-import-strip-signed-commits:
  fast-import: add '--signed-commits=<mode>' option
  gpg-interface: refactor 'enum sign_mode' parsing

3 days agoMerge branch 'ms/refs-optimize'
Junio C Hamano [Thu, 2 Oct 2025 19:26:12 +0000 (12:26 -0700)] 
Merge branch 'ms/refs-optimize'

"git refs optimize" is added for not very well explained reason
despite it does the same thing as "git pack-refs"...

* ms/refs-optimize:
  t: add test for git refs optimize subcommand
  t0601: refactor tests to be shareable
  builtin/refs: add optimize subcommand
  doc: pack-refs: factor out common options
  builtin/pack-refs: factor out core logic into a shared library
  builtin/pack-refs: convert to use the generic refs_optimize() API
  reftable-backend: implement 'optimize' action
  files-backend: implement 'optimize' action
  refs: add a generic 'optimize' API

3 days agoMerge branch 'jt/odb-transaction'
Junio C Hamano [Thu, 2 Oct 2025 19:26:11 +0000 (12:26 -0700)] 
Merge branch 'jt/odb-transaction'

The work to build on the bulk-checkin infrastructure to create many
objects at once in a transaction and to abstract it into the
generic object layer continues.

* jt/odb-transaction:
  odb: add transaction interface
  object-file: update naming from bulk-checkin
  object-file: relocate ODB transaction code
  bulk-checkin: drop flush_odb_transaction()
  builtin/update-index: end ODB transaction when --verbose is specified
  bulk-checkin: remove ODB transaction nesting

3 days agot8020: fix test failure due to indeterministic tag sorting
Patrick Steinhardt [Thu, 2 Oct 2025 11:04:40 +0000 (13:04 +0200)] 
t8020: fix test failure due to indeterministic tag sorting

In e6c06e87a2 (last-modified: fix bug when some paths remain unhandled,
2025-09-18), we have fixed a bug where under certain circumstances,
git-last-modified(1) would BUG because there's still some unhandled
paths. The fix claims that the root cause here is criss-cross merges,
and it adds a test case that seemingly exercises this.

Curiously, this test case fails on some systems because the actual
output does not match our expectations:

    diff --git a/expect b/actual
    index 5271607..bdc620e 100644
    --- a/expect
    --- b/actual
    @@ -1,3 +1,3 @@
     km3 a
    -k2 k
    +km2 k
     1 file
    error: last command exited with $?=1
    not ok 15 - last-modified with subdir and criss-cross merge

The output we see is git-name-rev(1) with `--annotate-stdin`. What it
does is to take the output of git-last-modified(1), which contains
object IDs of the blamed commits, and convert those object IDs into the
names of the corresponding tags. Interestingly, we indeed have both "k2"
and "km2" as tags, and even more interestingly both of these tags point
to the same commit. So the output we get isn't _wrong_, as the tags are
ambiguous.

But why do both of these tags point to the same commit? "km2" really is
supposed to be a merge, but due to the way the test is constructed the
merge turns into a fast-forward merge. Which means that the resulting
commit-graph does not even contain a criss-cross merge in the first place!
A quick test though shows that the test indeed triggers the bug, so
the initial analysis that the behaviour is triggered by such merges
must be wrong.

And it is: seemingly, the issue isn't with criss-cross merges, but
rather with a graph where different files in the same directory were
modified on both sides of a merge.

Refactor the test so that we explicitly test for this specific situation
instead of mentioning the "criss-cross merge" red herring. As the test
is very specific to the actual layout of the repository we also adapt it
to use its own standalone repository.

Note that this requires us to drop the `test_when_finished` call in
`check_last_modified` because it's not supported to execute that
function in a subshell.

This refactoring also fixes the original tag ambiguity that caused us to
fail on some platforms.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 days agogitlab-ci: upload Meson test logs as JUnit reports
Patrick Steinhardt [Thu, 2 Oct 2025 11:04:39 +0000 (13:04 +0200)] 
gitlab-ci: upload Meson test logs as JUnit reports

When running tests, Meson knows to output both a test log as well as a
JUnit test report that collates results. We don't currently upload these
results in our GitLab CI at all, which makes it hard to see which tests
ran, but also which of our tests may have failed.

Upload these JUnit reports as artifacts to make this information more
accessible. Note that we also do this for some jobs that don't use Meson
and thus don't generate these reports in the first place. GitLab CI
handles missing reports gracefully though, so there is no reason to
special-case those jobs that don't use Meson.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 days agogitlab-ci: drop workaround for Python certificate store on Windows
Patrick Steinhardt [Thu, 2 Oct 2025 11:04:38 +0000 (13:04 +0200)] 
gitlab-ci: drop workaround for Python certificate store on Windows

On Windows, we have been running into some issues in the past where the
certificate store for Python is broken on the GitLab CI runners using
Windows. The consequence was that we weren't able to establish any SSL
connections via Python, but we need that feature so that we can download
the Meson wraps. The workaround we employed was to import certificates
from the cURL project into the certificate store via OpenSSL.

This is obviously an ugly workaround. But even more importantly, this
workaround fails every time Chocolatey updates its OpenSSL packages. The
problem here is that the old OpenSSL package installer will be removed
immediately once the newer version was published, But the Chocolatey
community repository may not yet have propagated the new version of this
package to all of its caches. The result is that for a couple hours (or
sometimes even one or two days) we always fail to install OpenSSL until
the new version was propagated.

Luckily though, it turns out that the workaround doesn't seem to be
required anymore. Drop it to work around the intermittent failures and
to clean up some now-unneeded legacy cruft.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 days agogitlab-ci: ignore failures to disable realtime monitoring
Patrick Steinhardt [Thu, 2 Oct 2025 11:04:37 +0000 (13:04 +0200)] 
gitlab-ci: ignore failures to disable realtime monitoring

We have recently introduced a change to disable realtime monitoring for
Windows job in GitLab CI. This change led (and still leads) to a quite
significant speedup.

But there's a catch: seemingly, some of the runners we use already have
realtime monitoring disabled. On such a machine, trying to disable the
feature again leads to an error that causes the whole job to fail.

Safeguard against such failures by explicitly ignoring them.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 days agogitlab-ci: dedup instructions to disable realtime monitoring
Patrick Steinhardt [Thu, 2 Oct 2025 11:04:36 +0000 (13:04 +0200)] 
gitlab-ci: dedup instructions to disable realtime monitoring

The instruction to disable realtime monitoring are shared across all of
our Windows-based jobs. Deduplicate it so that we can more readily
iterate on it.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 days agoci: enable Rust for breaking-changes jobs
Patrick Steinhardt [Thu, 2 Oct 2025 07:29:34 +0000 (09:29 +0200)] 
ci: enable Rust for breaking-changes jobs

Enable Rust for our breaking-changes jobs so that we can verify that the
build infrastructure and the converted Rust subsystems work as expected.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 days agoci: convert "pedantic" job into full build with breaking changes
Patrick Steinhardt [Thu, 2 Oct 2025 07:29:33 +0000 (09:29 +0200)] 
ci: convert "pedantic" job into full build with breaking changes

The "pedantic" CI job is building on Fedora with `DEVOPTS=pedantic`.
This build flag doesn't do anything anymore starting with 6a8cbc41ba
(developer: enable pedantic by default, 2021-09-03), where we have
flipped the default so that developers have to opt-out of pedantic
builds via the "no-pedantic" option. As such, all this job really does
is to do a normal build on Fedora, which isn't all that interesting.

Convert that job into a full build-and-test job that uses Meson with
breaking changes enabled. This plugs two gaps:

  - We now test on another distro that we didn't run tests on
    beforehand.

  - We verify that breaking changes work as expected with Meson.

Furthermore, in a subsequent commit we'll modify both jobs that use
breaking changes to also enable Rust. By converting the Fedora job to
use Meson, we ensure that we test our Rust build infrastructure for both
build systems.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 days agoBreakingChanges: announce Rust becoming mandatory
Patrick Steinhardt [Thu, 2 Oct 2025 07:29:32 +0000 (09:29 +0200)] 
BreakingChanges: announce Rust becoming mandatory

Over the last couple of years the appetite for bringing Rust into the
codebase has grown significantly across the developer base. Introducing
Rust is a major change though and has ramifications for the whole
ecosystem:

  - Some platforms have a Rust toolchain available, but have not yet
    integrated it into their build infrastructure.

  - Some platforms don't have any support for Rust at all.

  - Some platforms may have to figure out how to fit Rust into their
    bootstrapping sequence.

Due to this, and given that Git is a critical piece of infrastructure
for the whole industry, we cannot just introduce such a heavyweight
dependency without doing our due diligence.

Instead, preceding commits have introduced a test balloon into our build
infrastructure that convert one tiny subsystem to use Rust. For now,
using Rust to build that subsystem is entirely optional -- if no Rust
support is available, we continue to use the C implementation. This test
balloon has the intention to give distributions time and let them ease
into our adoption of Rust.

Having multiple implementations of the same subsystem is not sustainable
though, and the plan is to eventually be able to use Rust freely all
across our codebase. As such, there is the intent to make Rust become a
mandatory part of our build process.

Add an announcement to our breaking changes that Rust will become
mandatory in Git 3.0. A (very careful and non-binding) estimate might be
that this major release might be released in the second half of next
year, which should give distributors enough time to prepare for the
change.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 days agovarint: reimplement as test balloon for Rust
Patrick Steinhardt [Thu, 2 Oct 2025 07:29:31 +0000 (09:29 +0200)] 
varint: reimplement as test balloon for Rust

Implement a trivial test balloon for our Rust build infrastructure by
reimplementing the "varint.c" subsystem in Rust. This subsystem is
chosen because it is trivial to convert and because it doesn't have any
dependencies to other components of Git.

If support for Rust is enabled, we stop compiling "varint.c" and instead
compile and use "src/varint.rs".

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 days agovarint: use explicit width for integers
Patrick Steinhardt [Thu, 2 Oct 2025 07:29:30 +0000 (09:29 +0200)] 
varint: use explicit width for integers

The varint subsystem currently uses implicit widths for integers. On the
one hand we use `uintmax_t` for the actual value. On the other hand, we
use `int` for the length of the encoded varint.

Both of these have known maximum values, as we only support at most 16
bytes when encoding varints. Thus, we know that we won't ever exceed
`uint64_t` for the actual value and `uint8_t` for the prefix length.

Refactor the code to use explicit widths. Besides making the logic
platform-independent, it also makes our life a bit easier in the next
commit, where we reimplement "varint.c" in Rust.

Suggested-by: Ezekiel Newren <ezekielnewren@gmail.com>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 days agohelp: report on whether or not Rust is enabled
Patrick Steinhardt [Thu, 2 Oct 2025 07:29:29 +0000 (09:29 +0200)] 
help: report on whether or not Rust is enabled

We're about to introduce support for Rust into the core of Git, where
some (trivial) subsystems are converted to Rust. These subsystems will
also retain a C implementation though as Rust is not yet mandatory.
Consequently, it now becomes possible for a Git version to have bugs
that are specific to whether or not it is built with Rust support
overall.

Expose information about whether or not Git was built with Rust via our
build info. This means that both `git version --build-options`, but also
`git bugreport` will now expose that bit of information. Hopefully, this
should make it easier for us to discover any Rust-specific issues.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 days agoMakefile: introduce infrastructure to build internal Rust library
Patrick Steinhardt [Thu, 2 Oct 2025 07:29:28 +0000 (09:29 +0200)] 
Makefile: introduce infrastructure to build internal Rust library

Introduce infrastructure to build the internal Rust library. This
mirrors the infrastructure we have added to Meson in the preceding
commit. Developers can enable the infrastructure by passing the new
`WITH_RUST` build toggle.

Inspired-by: Ezekiel Newren <ezekielnewren@gmail.com>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 days agoMakefile: reorder sources after includes
Patrick Steinhardt [Thu, 2 Oct 2025 07:29:27 +0000 (09:29 +0200)] 
Makefile: reorder sources after includes

In an upcoming change we'll make some of the sources compile
conditionally based on whether or not `WITH_RUST` is defined. To let
developers specify that flag in their "config.mak" we'll thus have to
reorder our sources so that they come after the include of that file.

Do so.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 days agomeson: add infrastructure to build internal Rust library
Patrick Steinhardt [Thu, 2 Oct 2025 07:29:26 +0000 (09:29 +0200)] 
meson: add infrastructure to build internal Rust library

Add the infrastructure into Meson to build an internal Rust library.
Building the Rust parts of Git are for now entirely optional, as they
are mostly intended as a test balloon for both Git developers, but also
for distributors of Git. So for now, they may contain:

  - New features that are not mission critical to Git and that users can
    easily live without.

  - Alternative implementations of small subsystems.

If these test balloons are successful, we will eventually make Rust a
mandatory dependency for our build process in Git 3.0.

The availability of a Rust toolchain will be auto-detected by Meson at
setup time. This behaviour can be tweaked via the `-Drust=` feature
toggle.

Next to the linkable Rust library, also wire up tests that can be
executed via `meson test`. This allows us to use the native unit testing
capabilities of Rust.

Note that the Rust edition is currently set to 2018. This edition is
supported by Rust 1.49, which is the target for the upcoming gcc-rs
backend. For now we don't use any features of Rust that would require a
newer version, so settling on this old version makes sense so that
gcc-rs may become an alternative backend for compiling Git. If we _do_
want to introduce features that were added in more recent editions of
Rust though we should reevaluate that choice.

Inspired-by: Ezekiel Newren <ezekielnewren@gmail.com>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 days agoSubmittingPatches: add section about AI
Christian Couder [Wed, 1 Oct 2025 14:02:50 +0000 (16:02 +0200)] 
SubmittingPatches: add section about AI

As more and more developer tools use AI, we are facing two main risks
related to AI generated content:

  - its situation regarding copyright and license is not clear,
    and:

  - more and more bad quality content could be submitted for review to
    the mailing list.

To mitigate both risks, let's add an "Use of Artificial Intelligence"
section to "Documentation/SubmittingPatches" with the goal of
discouraging its blind use to generate content that is submitted to
the project, while still allowing us to benefit from its help in some
innovative, useful and less risky ways.

Helped-by: Rick Sanders <rick@sfconservancy.org>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 days agodocs/gitcredentials: describe URL prefix matching
M Hickford [Wed, 1 Oct 2025 20:56:49 +0000 (20:56 +0000)] 
docs/gitcredentials: describe URL prefix matching

Documentation was inaccurate since 9a121b0d226 (credential: handle
`credential.<partial-URL>.<key>` again, 2020-04-24)

Add tests for documented behaviour.

Signed-off-by: M Hickford <mirth.hickford@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 days agorefs/ref-cache: fix SEGFAULT when seeking in empty directories
Karthik Nayak [Wed, 1 Oct 2025 12:17:29 +0000 (14:17 +0200)] 
refs/ref-cache: fix SEGFAULT when seeking in empty directories

The 'cache_ref_iterator_seek()' function is used to seek the
`ref_iterator` to the desired reference in the ref-cache mechanism. We
use the seeking functionality to implement the '--start-after' flag in
'git-for-each-ref(1)'.

When using the files-backend with packed-refs, it is possible that some
of the refs directories are empty. For e.g. just after repacking, the
'refs/heads' directory would be empty. The ref-cache seek mechanism,
doesn't take this into consideration when descending into a
subdirectory, and makes an out of bounds access, causing SEGFAULT as we
try to access entries within the directory. Fix this by breaking out of
the loop when we enter an empty directory.

Since we start with the base directory of 'refs/' which is never empty,
it is okay to perform this check after the first iteration in the
`do..while` clause.

Add tests which simulate this behavior and also provide coverage over
using the feature over packed-refs.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 days agobuiltin/history: implement "split" subcommand
Patrick Steinhardt [Wed, 1 Oct 2025 15:57:38 +0000 (17:57 +0200)] 
builtin/history: implement "split" subcommand

It is quite a common use case that one wants to split up one commit into
multiple commits by moving parts of the changes of the original commit
out into a separate commit. This is quite an involved operation though:

  1. Identify the commit in question that is to be dropped.

  2. Perform an interactive rebase on top of that commit's parent.

  3. Modify the instruction sheet to "edit" the commit that is to be
     split up.

  4. Drop the commit via "git reset HEAD~".

  5. Stage changes that should go into the first commit and commit it.

  6. Stage changes that should go into the second commit and commit it.

  7. Finalize the rebase.

This is quite complex, and overall I would claim that most people who
are not experts in Git would struggle with this flow.

Introduce a new "split" subcommand for git-history(1) to make this way
easier. All the user needs to do is to say `git history split $COMMIT`.
From hereon, Git asks the user which parts of the commit shall be moved
out into a separate commit and, once done, asks the user for the commit
message. Git then creates that split-out commit and applies the original
commit on top of it.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 days agocache-tree: allow writing in-memory index as tree
Patrick Steinhardt [Wed, 1 Oct 2025 15:57:37 +0000 (17:57 +0200)] 
cache-tree: allow writing in-memory index as tree

The function `write_in_core_index_as_tree()` takes a repository and
writes its index into a tree object. What this function cannot do though
is to take an _arbitrary_ in-memory index.

Introduce a new `struct index_state` parameter so that the caller can
pass a different index than the one belonging to the repository. This
will be used in a subsequent commit.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 days agoadd-patch: add support for in-memory index patching
Patrick Steinhardt [Wed, 1 Oct 2025 15:57:36 +0000 (17:57 +0200)] 
add-patch: add support for in-memory index patching

With `run_add_p()` callers have the ability to apply changes from a
specific revision to a repository's index. This infra supports several
different modes, like for example applying changes to the index,
worktree or both.

One feature that is missing though is the ability to apply changes to an
in-memory index different from the repository's index. Add a new
function `run_add_p_index()` to plug this gap.

This new function will be used in a subsequent commit.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 days agoadd-patch: remove dependency on "add-interactive" subsystem
Patrick Steinhardt [Wed, 1 Oct 2025 15:57:35 +0000 (17:57 +0200)] 
add-patch: remove dependency on "add-interactive" subsystem

With the preceding commit we have split out interactive configuration
that is used by both "git add -p" and "git add -i". But we still
initialize that configuration in the "add -p" subsystem by calling
`init_add_i_state()`, even though we only do so to initialize the
interactive configuration as well as a repository pointer.

Stop doing so and instead store and initialize the interactive
configuration in `struct add_p_state` directly.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 days agoadd-patch: split out `struct interactive_options`
Patrick Steinhardt [Wed, 1 Oct 2025 15:57:34 +0000 (17:57 +0200)] 
add-patch: split out `struct interactive_options`

The `struct add_p_opt` is reused both by our the infra for "git add -p"
and "git add -i". Users of `run_add_i()` for example are expected to
pass `struct add_p_opt`. This is somewhat confusing and raises the
question which options apply to what part of the stack.

But things are even more confusing than that: while callers are expected
to pass in `struct add_p_opt`, these options ultimately get used to
initialize a `struct add_i_state` that is used by both subsystems. So we
are basically going full circle here.

Refactor the code and split out a new `struct interactive_options` that
hosts common options used by both. These options are then applied to a
`struct interactive_config` that hosts common configuration.

This refactoring doesn't yet fully detangle the two subsystems from one
another, as we still end up calling `init_add_i_state()` in the "git add
-p" subsystem. This will be fixed in a subsequent commit.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 days agoadd-patch: split out header from "add-interactive.h"
Patrick Steinhardt [Wed, 1 Oct 2025 15:57:33 +0000 (17:57 +0200)] 
add-patch: split out header from "add-interactive.h"

While we have a "add-patch.c" code file, its declarations are part of
"add-interactive.h". This makes it somewhat harder than necessary to
find relevant code and to identify clear boundaries between the two
subsystems.

Split up concerns and move declarations that relate to "add-patch.c"
into a new "add-patch.h" header.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 days agobuiltin/history: implement "reword" subcommand
Patrick Steinhardt [Wed, 1 Oct 2025 15:57:32 +0000 (17:57 +0200)] 
builtin/history: implement "reword" subcommand

Implement a new "reword" subcommand for git-history(1). This subcommand
is essentially the same as if a user performed an interactive rebase
with a single commit changed to use the "reword" verb.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 days agobuiltin: add new "history" command
Patrick Steinhardt [Wed, 1 Oct 2025 15:57:31 +0000 (17:57 +0200)] 
builtin: add new "history" command

When rewriting history via git-rebase(1) there are a couple of very
common use cases:

  - The ordering of two commits should be reversed.

  - A commit should be split up into two commits.

  - A commit should be dropped from the history completely.

  - Multiple commits should be squashed into one.

While these operations are all doable, it often feels needlessly cludgy
to do so by doing an interactive rebase, using the editor to say what
one wants, and then perform the actions. Furthermore, some operations
like splitting up a commit into two are way more involved than that and
require a whole series of commands.

Add a new "history" command to plug this gap. This command will have
several different subcommands to imperatively rewrite history for common
use cases like the above. These commands will be implemented in
subsequent commits.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 days agoreplay: parse commits before dereferencing them
Patrick Steinhardt [Wed, 1 Oct 2025 15:57:30 +0000 (17:57 +0200)] 
replay: parse commits before dereferencing them

When looking up a commit it may not be parsed yet. Callers that wish to
access the fields of `struct commit` have to call `repo_parse_commit()`
first so that it is guaranteed to be populated.

We didn't yet care about doing so, because code paths that lead to
`pick_regular_commit()` in "builtin/replay.c" already implicitly parsed
the commits. But now that the function is exposed to outside callers
it's quite easy to get this wrong.

Make the function easier to use by calling `repo_parse_commit()`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 days agoreplay: stop using `the_repository`
Patrick Steinhardt [Wed, 1 Oct 2025 15:57:29 +0000 (17:57 +0200)] 
replay: stop using `the_repository`

In `create_commit()` we're using `the_repository` even though we already
have a repository passed to use as an argument. Fix this.

Note that we still cannot get rid of `USE_THE_REPOSITORY_VARIABLE`. This
is because we use `DEFAULT_ABBREV and `get_commit_output_encoding()`,
both of which are stored as global variables that can be modified via
the Git configuration.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 days agoreplay: extract logic to pick commits
Patrick Steinhardt [Wed, 1 Oct 2025 15:57:28 +0000 (17:57 +0200)] 
replay: extract logic to pick commits

We're about to add a new git-history(1) command that will reuse some of
the same infrastructure as git-replay(1). To prepare for this, extract
the logic to pick a commit into a new "replay.c" file so that it can be
shared between both commands.

Rename the function to have a "replay_" prefix to clearly indicate its
subsystem.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 days agowt-status: provide function to expose status for trees
Patrick Steinhardt [Wed, 1 Oct 2025 15:57:27 +0000 (17:57 +0200)] 
wt-status: provide function to expose status for trees

The "wt-status" subsystem is responsible for printing status information
around the current state of the working tree. This most importantly
includes information around whether the working tree or the index have
any changes.

We're about to introduce a new command though where the changes in
neither of them are actually relevant to us. Instead, what we want is to
format the changes between two different trees. While it is a little bit
of a stretch to add this as functionality to _working tree_ status, it
doesn't make any sense to open-code this functionality, either.

Implement a new function `wt_status_collect_changes_trees()` that diffs
two trees and formats the status accordingly. This function is not yet
used, but will be in a subsequent commit.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 days agoMerge branch 'sa/replay-atomic-ref-updates' into ps/history
Junio C Hamano [Wed, 1 Oct 2025 19:32:36 +0000 (12:32 -0700)] 
Merge branch 'sa/replay-atomic-ref-updates' into ps/history

* sa/replay-atomic-ref-updates:
  replay: make atomic ref updates the default behavior

4 days agogitk: add theme selection to color configuration page
Mark Levedahl [Mon, 22 Sep 2025 17:15:49 +0000 (13:15 -0400)] 
gitk: add theme selection to color configuration page

gitk allows configuring a particular theme in its configuration file
(default on linux: ~/.config/git/gitk), but offers no ability to modify
this from gitk's configuration editor. Let's add this to the color
configuration page.

Present the offered themes in a list, and allow choosing / modifying a
theme definition file ($themeloader). Update the list of themes if the
theme file is modified, and update the theme if specifically requested
(by default, just change the value for use after gitk is restarted).

Any theme definition file can change the global options database,
affecting potentially any theme. So, the ultimate configuration should
have either
- no theme definition file (themeloader = {}), and a native Tk, theme,
or
- themeloader naming a valid file, and $theme naming a theme defined by
  that file.

But, there is no trivial way to enforce the above. Shrug.

Helped-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
4 days agobuiltin/reflog: respect user config in "write" subcommand
Michael Lohmann [Tue, 30 Sep 2025 19:53:20 +0000 (21:53 +0200)] 
builtin/reflog: respect user config in "write" subcommand

The reflog write recognizes only GIT_COMMITTER_NAME and
GIT_COMMITTER_EMAIL environment variables, but forgot to honor the
user.name and user.email configuration variables, due to lack of
repo_config() call to grab these values from the configuration files.

The test suite sets these variables, so this behavior was unnoticed.

Ensure that the reflog write also uses the values of user.name and
user.email if set in the Git configuration.

Co-authored-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Michael Lohmann <git@lohmann.sh>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 days agoSQUASH???
Junio C Hamano [Tue, 30 Sep 2025 21:03:30 +0000 (14:03 -0700)] 
SQUASH???

5 days agodoc: git-push: add explanation of `git push origin main`
Julia Evans [Tue, 30 Sep 2025 19:58:34 +0000 (19:58 +0000)] 
doc: git-push: add explanation of `git push origin main`

What happens if you run `git push` without any arguments is actually
extremely complex to explain, as discussed in the previous commit.

But it's very easy to explain what `git push <remote> <branch>` does, so
start the man page by explaining what that does.

The hope is that someone could just stop reading the man page here and
never learn anything else about `git push`, and that would be fine.

Signed-off-by: Julia Evans <julia@jvns.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 days agoxdiff: rename rchg -> changed in xdfile_t
Ezekiel Newren [Fri, 26 Sep 2025 22:41:57 +0000 (22:41 +0000)] 
xdiff: rename rchg -> changed in xdfile_t

The field rchg (now 'changed') declares if a line in a file is changed
or not. A later commit will change it's type from 'char' to 'bool'
to make its purpose even more clear.

Best-viewed-with: --color-words
Signed-off-by: Ezekiel Newren <ezekielnewren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 days agoxdiff: delete chastore from xdfile_t
Ezekiel Newren [Fri, 26 Sep 2025 22:41:56 +0000 (22:41 +0000)] 
xdiff: delete chastore from xdfile_t

xdfile_t currently uses chastore_t which is an arena allocator. I
think that xrecord_t used to be a linked list and recs didn't exist
originally. When recs was added I think they forgot to remove
xdfile_t.next, but was overlooked. This dual data structure setup
makes the code somewhat confusing.

Additionally the C type chastore_t isn't FFI friendly, and provides
little to no performance benefit over using realloc to grow an array.

Performance impact of deleting fields from xdfile_t:
Deleting ha is about 5% slower.
Deleting cha is about 5% faster.

Delete ha, but keep cha
  time hyperfine --warmup 3 -L exe build_v2.51.0/git,build_delete_ha/git '{exe} log --oneline --shortstat --diff-algorithm=myers -3000 v2.39.1 >/dev/null'
  Benchmark 1: build_v2.51.0/git log --oneline --shortstat --diff-algorithm=myers -3000 v2.39.1 >/dev/null
    Time (mean ± σ):      1.269 s ±  0.017 s    [User: 1.135 s, System: 0.128 s]
    Range (min … max):    1.249 s …  1.286 s    10 runs

  Benchmark 2: build_delete_ha/git log --oneline --shortstat --diff-algorithm=myers -3000 v2.39.1 >/dev/null
    Time (mean ± σ):      1.339 s ±  0.017 s    [User: 1.234 s, System: 0.099 s]
    Range (min … max):    1.320 s …  1.358 s    10 runs

  Summary
    build_v2.51.0/git log --oneline --shortstat --diff-algorithm=myers -3000 v2.39.1 >/dev/null ran
      1.06 ± 0.02 times faster than build_delete_ha/git log --oneline --shortstat --diff-algorithm=myers -3000 v2.39.1 >/dev/null

Delete cha, but keep ha
  time hyperfine --warmup 3 -L exe build_v2.51.0/git,build_delete_chastore/git '{exe} log --oneline --shortstat --diff-algorithm=myers -3000 v2.39.1 >/dev/null'
  Benchmark 1: build_v2.51.0/git log --oneline --shortstat --diff-algorithm=myers -3000 v2.39.1 >/dev/null
    Time (mean ± σ):      1.290 s ±  0.001 s    [User: 1.154 s, System: 0.130 s]
    Range (min … max):    1.288 s …  1.292 s    10 runs

  Benchmark 2: build_delete_chastore/git log --oneline --shortstat --diff-algorithm=myers -3000 v2.39.1 >/dev/null
    Time (mean ± σ):      1.232 s ±  0.017 s    [User: 1.105 s, System: 0.121 s]
    Range (min … max):    1.205 s …  1.249 s    10 runs

  Summary
    build_delete_chastore/git log --oneline --shortstat --diff-algorithm=myers -3000 v2.39.1 >/dev/null ran
      1.05 ± 0.01 times faster than build_v2.51.0/git log --oneline --shortstat --diff-algorithm=myers -3000 v2.39.1 >/dev/null

Delete ha AND chastore
  time hyperfine --warmup 3 -L exe build_v2.51.0/git,build_delete_ha_and_chastore/git '{exe} log --oneline --shortstat --diff-algorithm=myers -3000 v2.39.1 >/dev/null'
  Benchmark 1: build_v2.51.0/git log --oneline --shortstat --diff-algorithm=myers -3000 v2.39.1 >/dev/null
    Time (mean ± σ):      1.291 s ±  0.002 s    [User: 1.156 s, System: 0.129 s]
    Range (min … max):    1.287 s …  1.295 s    10 runs

  Benchmark 2: build_delete_ha_and_chastore/git log --oneline --shortstat --diff-algorithm=myers -3000 v2.39.1 >/dev/null
    Time (mean ± σ):      1.306 s ±  0.001 s    [User: 1.195 s, System: 0.105 s]
    Range (min … max):    1.305 s …  1.308 s    10 runs

  Summary
    build_v2.51.0/git log --oneline --shortstat --diff-algorithm=myers -3000 v2.39.1 >/dev/null ran
      1.01 ± 0.00 times faster than build_delete_ha_and_chastore/git log --oneline --shortstat --diff-algorithm=myers -3000 v2.39.1 >/dev/null

Best-viewed-with: --color-words
Signed-off-by: Ezekiel Newren <ezekielnewren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 days agoxdiff: delete fields ha, line, size in xdlclass_t in favor of an xrecord_t
Ezekiel Newren [Fri, 26 Sep 2025 22:41:55 +0000 (22:41 +0000)] 
xdiff: delete fields ha, line, size in xdlclass_t in favor of an xrecord_t

The fields from xdlclass_t are aliases of xrecord_t:
xdlclass_t.line -> xrecord_t.ptr
xdlclass_t.size -> xrecord_t.size
xdlclass_t.ha   -> xrecord_t.ha

xdlclass_t carries a copy of the data in xrecord_t, but instead of
embedding xrecord_t it duplicates the individual fields. A future
commit will change the types used in xrecord_t so embed it in
xdlclass_t first, so we don't have to remember to change the types
here as well.

Best-viewed-with: --color-words
Helped-by: Phillip Wood <phillip.wood123@gmail.com>
Signed-off-by: Ezekiel Newren <ezekielnewren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 days agoxdiff: delete redundant array xdfile_t.ha
Ezekiel Newren [Fri, 26 Sep 2025 22:41:54 +0000 (22:41 +0000)] 
xdiff: delete redundant array xdfile_t.ha

When 0 <= i < xdfile_t.nreff the following is true:
xdfile_t.ha[i] == xdfile_t.recs[xdfile_t.rindex[i]]

This makes the code about 5% slower. The fields rindex and ha are
specific to the classic diff (myers and minimal). I plan on creating a
struct for classic diff, but there's a lot of cleanup that needs to be
done before that can happen and leaving ha in would make those cleanups
harder to follow.

A subsequent commit will delete the chastore cha from xdfile_t. That
later commit will investigate deleting ha and cha independently and
together.

Signed-off-by: Ezekiel Newren <ezekielnewren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>