Commit Graph

81459 Commits (afe427dc66dbcc20b25a2732023780f77e91c552)

Author SHA1 Message Date
Junio C Hamano afe427dc66 Merge branch 'kk/merge-octopus-optim' into next
The logic to determine that branches in an octopus merge are
independent has been optimized.

* kk/merge-octopus-optim:
  merge: use repo_in_merge_bases for octopus up-to-date check
2026-05-20 10:32:35 +09:00
Junio C Hamano 722acf81c8 Merge branch 'en/batch-prefetch' into next
In a lazy clone, "git cherry" and "git grep" often fetch necessary
blob objects one by one from promisor remotes.  It has been corrected
to collect necessary object names and fetch them in bulk to gain
reasonable performance.

* en/batch-prefetch:
  grep: prefetch necessary blobs
  builtin/log: prefetch necessary blobs for `git cherry`
  patch-ids.h: add missing trailing parenthesis in documentation comment
  promisor-remote: document caller filtering contract
2026-05-20 10:32:35 +09:00
Junio C Hamano 725a20bf93 Merge branch 'jk/apply-leakfix' into next
Leakfix.

* jk/apply-leakfix:
  apply: plug leak on "patch too large" error
2026-05-20 10:32:34 +09:00
Junio C Hamano e1a320d4e5 Merge branch 'jk/commit-sign-overflow-fix' into next
Leakfix.

* jk/commit-sign-overflow-fix:
  commit: handle large commit messages in utf8 verification
2026-05-20 10:32:34 +09:00
Junio C Hamano 38c9fb15c2 Merge branch 'rs/trailer-fold-optim' into next
Code simplification.

* rs/trailer-fold-optim:
  trailer: change strbuf in-place in unfold_value()
2026-05-20 10:32:34 +09:00
Junio C Hamano fe8d31e9f9 Merge branch 'pb/doc-diff-format-updates' into next
Doc updates.

* pb/doc-diff-format-updates:
  diff-format.adoc: mode and hash are 0* for unmerged paths from index only
  diff-format.adoc: 'git diff-files' prints two lines for unmerged files
  diff-format.adoc: remove mention of diff-tree specific output
2026-05-20 10:32:34 +09:00
Junio C Hamano 4f17f83d09 Sync with 'master' 2026-05-19 10:00:37 +09:00
Junio C Hamano f17450dd1b Merge branch 'kk/limit-list-optim' into next
The limit_list() function that is one of the core part of the
revision traversal infrastructure has been optimized by replacing
its use of linear list with priority queue.

* kk/limit-list-optim:
  revision: use priority queue in limit_list()
2026-05-19 10:00:18 +09:00
Junio C Hamano ecee155d5c Merge branch 'tb/pseudo-merge-bugfixes' into next
Fixes many bugs in pseudo-merge code.

* tb/pseudo-merge-bugfixes:
  pack-bitmap: prevent pattern leak on pseudo-merge re-assignment
  Documentation: fix broken `sampleRate` in gitpacking(7)
  pack-bitmap: reject pseudo-merge "sampleRate" of 0
  pack-bitmap: parse commits in `find_pseudo_merge_group_for_ref()`
  pack-bitmap: fix pseudo-merge lookup for shared commits
  pack-bitmap: fix inverted binary search in `pseudo_merge_at()`
  pack-bitmap-write: sort pseudo-merge commit lookup table in pack order
  t5333: demonstrate various pseudo-merge bugs
  t/helper: add 'test-tool bitmap write' subcommand
2026-05-19 10:00:18 +09:00
Junio C Hamano 7bcaabddcf The 4th batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-05-19 09:57:46 +09:00
Junio C Hamano bad1648bf0 Merge branch 'sj/submodule-update-clone-config-fix'
The configuration variable submodule.fetchJobs was not read correctly,
which has been corrected.

* sj/submodule-update-clone-config-fix:
  submodule-config: fix reading submodule.fetchJobs
2026-05-19 09:57:46 +09:00
Junio C Hamano ded7b8cf55 Merge branch 'rs/sideband-clear-line-before-print'
Tweak the way how sideband messages from remote are printed while
we talk with a remote repository to avoid tickling terminal
emulator glitches.

* rs/sideband-clear-line-before-print:
  sideband: clear full line when printing remote messages
2026-05-19 09:57:46 +09:00
Junio C Hamano 1cde0a68d8 Merge branch 'ag/rebase-update-refs-limit-to-branches'
"git rebase --update-refs", when used with an rebase.instructionFormat
with "%d" (describe) in it, tried to update local branch HEAD by
mistake, which has been corrected.

* ag/rebase-update-refs-limit-to-branches:
  rebase: ignore non-branch update-refs
2026-05-19 09:57:46 +09:00
Junio C Hamano c297fdf18c Merge branch 'kh/doc-restore-double-underscores-fix'
Doc update.

* kh/doc-restore-double-underscores-fix:
  doc: restore: remove double underscore
2026-05-19 09:57:45 +09:00
Junio C Hamano 55c4feae1c Merge branch 'kh/doc-commit-graph'
Ramifications of turning off commit-graph has been documented a bit
more clearly.

* kh/doc-commit-graph:
  doc: add caveat about turning off commit-graph
2026-05-19 09:57:44 +09:00
Junio C Hamano 056472b82d Merge branch 'kh/name-rev-custom-format'
A new builtin "git format-rev" is introduced for pretty formatting
one revision expression per line or commit object names found in
running text.

* kh/name-rev-custom-format:
  format-rev: introduce builtin for on-demand pretty formatting
  name-rev: make dedicated --annotate-stdin --name-only test
  name-rev: factor code for sharing with a new command
  name-rev: run clang-format before factoring code
  name-rev: wrap both blocks in braces
2026-05-19 09:57:44 +09:00
Junio C Hamano 6bfdc87e99 Merge branch 'sg/t6112-unwanted-tilde-expansion-fix'
Test fix.

* sg/t6112-unwanted-tilde-expansion-fix:
  t6112: avoid tilde expansion
2026-05-19 09:57:44 +09:00
Junio C Hamano 0330568152 Merge branch 'en/xdiff-cleanup-3'
Preparation of the xdiff/ codebase to work with Rust.

* en/xdiff-cleanup-3:
  xdiff/xdl_cleanup_records: make execution of action easier to follow
  xdiff/xdl_cleanup_records: make setting action easier to follow
  xdiff/xdl_cleanup_records: make limits more clear
  xdiff/xdl_cleanup_records: use unambiguous types
  xdiff: use unambiguous types in xdl_bogo_sqrt()
  xdiff/xdl_cleanup_records: delete local recs pointer
2026-05-19 09:57:44 +09:00
Junio C Hamano 60afbae98d Merge branch 'mc/http-emptyauth-negotiate-fix'
The 'http.emptyAuth=auto' configuration now correctly attempts
Negotiate authentication before falling back to manual credentials.
This allows seamless Kerberos ticket-based authentication without
requiring users to explicitly set 'http.emptyAuth=true'.

* mc/http-emptyauth-negotiate-fix:
  doc: clarify http.emptyAuth values
  t5563: add tests for http.emptyAuth with Negotiate
  http: attempt Negotiate auth in http.emptyAuth=auto mode
  http: extract http_reauth_prepare() from retry paths
2026-05-19 09:57:43 +09:00
Junio C Hamano 3ed373ac14 Sync with 'master' 2026-05-17 23:01:33 +09:00
Junio C Hamano c1a51214fb Merge branch 'jk/dumb-http-alternate-fix' into next
The HTTP walker misinterpreted the alternates file that gives an
absolute path when the server URL does not have the final slash
(i.e., "https://example.com" not "https://example.com/").

* jk/dumb-http-alternate-fix:
  http: handle absolute-path alternates from server root
2026-05-17 23:01:23 +09:00
Junio C Hamano ee684c614f Merge branch 'jk/pretty-no-strbuf-presizing' into next
Remove ineffective strbuf presizing that would have computed an
allocation that would not have fit in the available memory anyway,
or too small due to integer wraparound to cause immediate automatic
growing.

* jk/pretty-no-strbuf-presizing:
  pretty: drop strbuf pre-sizing from add_rfc2047()
2026-05-17 23:01:23 +09:00
Junio C Hamano 8553437ae1 Merge branch 'ag/sequencer-remove-unused-struct-member' into next
Code clean-up.

* ag/sequencer-remove-unused-struct-member:
  sequencer: remove todo_add_branch_context.commit
2026-05-17 23:01:22 +09:00
Junio C Hamano d81439a049 Merge branch 'mm/diff-U-takes-no-negative-values' into next
The command line parser for "git diff" learned a few options take
only non-negative integers.

* mm/diff-U-takes-no-negative-values:
  parse-options: clarify what "negated" means for PARSE_OPT_NONEG
  xdiff: guard against negative context lengths
  diff: reject negative values for -U/--unified
  diff: reject negative values for --inter-hunk-context
2026-05-17 23:01:22 +09:00
Junio C Hamano ddc761aec6 Merge branch 'dk/doc-exclude-is-shared-per-repo' into next
Document the fact that .git/info/exclude is shared across worktrees
linked to the same repository.

* dk/doc-exclude-is-shared-per-repo:
  ignore: note info/exclude lives in GIT_COMMON_DIR, not GIT_DIR
2026-05-17 23:01:22 +09:00
Junio C Hamano 2e39c767e5 Merge branch 'kk/paint-down-to-common-optim' into next
"git merge-base" optimization.

* kk/paint-down-to-common-optim:
  commit-reach: early exit paint_down_to_common for single merge-base
  commit-reach: introduce merge_base_flags enum
2026-05-17 23:01:22 +09:00
Junio C Hamano 68aca6b912 The 3rd batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-05-17 22:58:31 +09:00
Junio C Hamano 6d7492cf85 Merge branch 'rs/grep-column-only-match-fix'
"git grep" update.

* rs/grep-column-only-match-fix:
  grep: fix --column --only-match for 2nd and later matches
2026-05-17 22:58:31 +09:00
Junio C Hamano d17a7b8191 Merge branch 'hn/git-checkout-m-with-stash'
"git checkout -m another-branch" was invented to deal with local
changes to paths that are different between the current and the new
branch, but it gave only one chance to resolve conflicts.  The command
was taught to create a stash to save the local changes.

* hn/git-checkout-m-with-stash:
  checkout -m: autostash when switching branches
  checkout: rollback lock on early returns in merge_working_tree
  sequencer: teach autostash apply to take optional conflict marker labels
  sequencer: allow create_autostash to run silently
  stash: add --label-ours, --label-theirs, --label-base for apply
2026-05-17 22:58:31 +09:00
Junio C Hamano 068c10c741 Merge branch 'pw/rename-to-get-current-worktree'
Code clean-up.

* pw/rename-to-get-current-worktree:
  worktree: rename get_worktree_from_repository()
2026-05-17 22:58:30 +09:00
Junio C Hamano c26c58de0c Merge branch 'mf/format-patch-cover-letter-format-docfix'
Docfix.

* mf/format-patch-cover-letter-format-docfix:
  Fix docs for format.commitListFormat
2026-05-17 22:58:30 +09:00
Junio C Hamano 3cfbb7b3f7 Merge branch 'en/ort-cached-rename-with-trivial-resolution'
"ort" merge backend improvements.

* en/ort-cached-rename-with-trivial-resolution:
  merge-ort: handle cached rename & trivial resolution interaction better
2026-05-17 22:58:30 +09:00
Junio C Hamano f7ae594a85 Merge branch 'ss/t7004-unhide-git-failures'
Test clean-up.

* ss/t7004-unhide-git-failures:
  t7004: avoid subshells to capture git exit codes
  t7004: dynamically grab expected state in tests
  t7004: drop hardcoded tag count for state verification
2026-05-17 22:58:30 +09:00
Junio C Hamano 27caa6b4f7 Merge branch 'en/backfill-fixes-and-edges'
The 'git backfill' command now rejects revision-limiting options that
are incompatible with its operation, uses standard documentation for
revision ranges, and includes blobs from boundary commits by default
to improve performance of subsequent operations.

* en/backfill-fixes-and-edges:
  backfill: default to grabbing edge blobs too
  backfill: document acceptance of revision-range in more standard manner
  backfill: reject rev-list arguments that do not make sense
2026-05-17 22:58:29 +09:00
Philippe Blain 6d09e798bc diff-format.adoc: mode and hash are 0* for unmerged paths from index only
In the "Raw output format" section, we mention that the 'mode' and
'sha1' for "src" and "dst" are 0* if "(creation|deletion) or unmerged".
For unmerged entries, 'mode' and 'sha1' are in fact 0* only when we are
looking at the index, i.e. on the left side for 'git diff-files' and on
the right side for 'git diff-index --cached'. Be more precise by
mentioning this, and while at it uniformize the wording of the "work
tree out of sync with the index" case.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-05-16 22:21:37 +09:00
Philippe Blain 4cd5d8a3c8 diff-format.adoc: 'git diff-files' prints two lines for unmerged files
Since 10637b84d9 (diff-files: -1/-2/-3 to diff against unmerged stage.,
2005-11-29), for unmerged entries 'git diff-files' print both an
"unmerged" line ('U'), as well as an "in-place edit" line ('M')
comparing stage 2 (by default) with the working tree. The "Raw output
format" documentation however mentions that all commands print a single
line per changed file. Adjust diff-format.adoc to also mention this
special case, for completeness.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-05-16 22:21:37 +09:00
Philippe Blain 15abb27e3a diff-format.adoc: remove mention of diff-tree specific output
In the "Raw output format" section, we start by mentioning that 'git
diff-tree' prints the hashes of what is being compared. This is only
true in --stdin mode, and is already mentioned in the description of
'--stdin' in git-diff-tree.adoc. Remove this sentence such that we only
focus on the common output between diff-tree, diff-index, diff-files and

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-05-16 22:21:37 +09:00
René Scharfe 34a891a2d3 trailer: change strbuf in-place in unfold_value()
Avoid an allocation by doing s/\n\s*/ /g (replacing NL and any following
whitespace with a SP) right in the strbuf instead of copying the result
to a temporary one and swapping them in the end.  We can safely do that
because the replacement is never longer than the original string.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-05-16 22:11:07 +09:00
Jeff King 65ea197dca commit: handle large commit messages in utf8 verification
Running t4205 under UBSan with the EXPENSIVE prereq enabled triggers an
error when we try to create a commit message that is over 2GB:

  commit.c:1574:6: runtime error: signed integer overflow:
    -2147483648 - 1 cannot be represented in type 'int'

The problem is that find_invalid_utf8() is not prepared to handle
large buffers, as it uses an "int" to represent buffer sizes and
offsets.

We can fix this with a few changes:

  1. We'll take in "len" as a size_t (which is what the caller has
     anyway, since it's working with a strbuf).

  2. We need to return a size_t to give the offset to the invalid utf8,
     but we also need a sentinel value for "no invalid value"
     (previously "-1"). Let's split these to return a bool for "found
     invalid utf8" and then pass back the offset as an out-parameter.
     We'll switch the function name to match the new semantics.

  3. The caller in verify_utf8() uses a "long" to store buffer
     positions, which is a bit funny. This goes back to 08a94a145c
     (commit/commit-tree: correct latin1 to utf-8, 2012-06-28) and is
     perhaps trying to match our use of "unsigned long" for object sizes
     (though we don't care about it ever becoming negative here). This
     should be a size_t, too, as some platforms (like Windows) still use
     a 32-bit long on machines with 64-bit pointers.

  4. The "bytes" field within find_invalid_utf() does not have range
     problems. It is the number of bytes the utf8 sequence claims to
     have, so is limited by how many bits can be set in a single 8-bit
     byte. However, if we leave it as an "int" then the compiler will
     complain about the sign mismatch when comparing it to "len". So
     let's make it unsigned, too.

All of this is a little silly, of course, because 2GB text commit
messages are clearly nonsense. So we might consider rejecting them
outright, but it is easy enough to make these helper functions more
robust in the meantime.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-05-16 21:43:14 +09:00
Jeff King 3ccb16052a apply: plug leak on "patch too large" error
In apply_patch(), we return immediately if read_patch_file() returns an
error. Traditionally this was OK, since an error from strbuf_read()
would restore the strbuf to its unallocated state.

But since f1c0e3946e (apply: reject patches larger than ~1 GiB,
2022-10-25), we may also return an error if we successfully read the
patch but it is too large. In this case we leak the strbuf contents when
apply_patch() returns.

You can see it in action by running t4141 under LSan with the EXPENSIVE
prereq enabled.

We can fix this in one of two places:

  1. In read_patch_file(), we could release the buffer before returning
     the error, behaving more like a raw strbuf_read() call.

  2. In apply_patch(), we can release the strbuf ourselves before
     returning.

I picked the latter, since it future proofs us against read_patch_file()
getting new error modes. We also have a cleanup label in that function
already, so now our error handling at this spot matches the rest of the
function (and all of the variables are initialized such that the rest of
the cleanup is correctly a noop at this point).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-05-16 13:51:16 +09:00
Junio C Hamano 67dd491aae Merge branch 'sp/shallow-deepen-on-non-shallow-repo-fix' into next
"git fetch --deepen=<n>" in a full clone truncated the history to <n>
commits deep, which has been corrected to be a no-op instead.

* sp/shallow-deepen-on-non-shallow-repo-fix:
  shallow: fix relative deepen on non-shallow repositories
2026-05-15 10:46:54 +09:00
Junio C Hamano d258bb5e55 Merge branch 'jc/ci-enable-expensive' into next
Enable expensive tests to catch topics that may cause breakages on
integration branches closer to their origin in the contributor PR
builds.

* jc/ci-enable-expensive:
  ci: enable EXPENSIVE for contributor builds
2026-05-15 10:46:53 +09:00
Junio C Hamano da9c1b71d7 Merge branch 'aw/validate-proxy-url-scheme' into next
Misspelt proxy URL (e.g., httt://...) did not trigger any warning
or failure, which has been corrected.

* aw/validate-proxy-url-scheme:
  http: reject unsupported proxy URL schemes
2026-05-15 10:46:53 +09:00
Junio C Hamano 416deceeeb Merge branch 'mm/git-url-parse' into next
The internal URL parsing logic has been made accessible via a new
subcommand "git url-parse".

* mm/git-url-parse:
  t9904: add tests for the new url-parse builtin
  doc: describe the url-parse builtin
  builtin: create url-parse command
  urlmatch: define url_parse function
  url: return URL_SCHEME_UNKNOWN instead of dying
  url: move scheme detection to URL header/source
  url: move url_is_local_not_ssh to url.h
  connect: rename enum protocol to url_scheme
2026-05-15 10:46:53 +09:00
Junio C Hamano 7a867909d2 Merge branch 'pw/xdiff-shrink-memory-consumption' into next
Shrink wasted memory in Myers diff that does not account for common
prefix and suffix removal.

* pw/xdiff-shrink-memory-consumption:
  xdiff: reduce the size of array
  xprepare: simplify error handling
  xdiff: cleanup xdl_clean_mmatch()
  xdiff: reduce size of action arrays
2026-05-15 10:46:53 +09:00
Junio C Hamano f740311a37 Merge branch 'kh/doc-log-decorate-list' into next
Doc update.

* kh/doc-log-decorate-list:
  doc: log: use the same delimiter in description list
  doc: log: fix --decorate description list
2026-05-15 10:46:52 +09:00
Junio C Hamano 62cb4e0ce2 Merge branch 'kn/refs-generic-helpers' into next
Refactor service routines in the ref subsystem backends.

* kn/refs-generic-helpers:
  refs: use peeled tag values in reference backends
  refs: add peeled object ID to the `ref_update` struct
  refs: move object parsing to the generic layer
  update-ref: handle rejections while adding updates
  update-ref: move `print_rejected_refs()` up
  refs: return `ref_transaction_error` from `ref_transaction_update()`
  refs: extract out reflog config to generic layer
  refs: introduce `ref_store_init_options`
  refs: remove unused typedef 'ref_transaction_commit_fn'
2026-05-15 10:46:52 +09:00
Junio C Hamano 3b524d0ba5 Merge branch 'za/t2000-modernise-more' into next
Test update.

* za/t2000-modernise-more:
  t2000: consolidate second scenario into a single test block
2026-05-15 10:46:52 +09:00
Kristofer Karlsson ef8d51a8a3 revision: use priority queue in limit_list()
limit_list() maintains a date-sorted work queue of commits using a
linked list with commit_list_insert_by_date() for insertion.  Each
insertion walks the list to find the right position — O(n) per insert.
In repositories with merge-heavy histories, the symmetric difference
can contain thousands of commits, making this O(n) insertion the
dominant cost.

Replace the sorted linked list with a prio_queue (binary heap).  This
gives O(log n) insertion and O(log n) extraction instead of O(n)
insertion and O(1) extraction, which is a net win when the queue is
large.

The still_interesting() and everybody_uninteresting() helpers are
updated to scan the prio_queue's contiguous array instead of walking a
linked list.  process_parents() already accepts both a commit_list and
a prio_queue parameter, so the change in limit_list() simply switches
which one is passed.

Benchmark: git rev-list --left-right --count HEAD~N...HEAD
Repository: 2.3M commits, merge-heavy DAG (monorepo)
Best of 5 runs, times in seconds:

  commits in
  symmetric diff   baseline   patched    speedup
  --------------   --------   -------    -------
            10       0.01      0.01       1.0x
            50       0.01      0.01       1.0x
          3751      21.23      8.49       2.5x
          4524      21.70      8.29       2.6x
         10130      20.10      6.65       3.0x

No change for small traversals; 2.5-3.0x faster when the queue grows
to thousands of commits.

Signed-off-by: Kristofer Karlsson <krka@spotify.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-05-15 04:26:25 +09:00
Elijah Newren 854061ea54 grep: prefetch necessary blobs
In partial clones, `git grep` fetches necessary blobs on-demand one
at a time, which can be very slow.  In partial clones, add an extra
preliminary walk over the tree similar to grep_tree() which collects
the blobs of interest, and then prefetches them.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-05-15 04:24:54 +09:00