Commit Graph

81880 Commits (45dbcc630738ff4836602003bd00737c7e41d83b)

Author SHA1 Message Date
Junio C Hamano 45dbcc6307 Merge branch 'sk/userdiff-swift' into next
Userdiff patterns for Swift have been added, with support for
Swift-specific constructs such as attributes, modifiers, failable
initializers, and generics.

* sk/userdiff-swift:
  userdiff: add support for Swift
2026-07-23 10:33:52 -07:00
Junio C Hamano 749560a29c Merge branch 'ty/migrate-excludes-file' into next
The 'excludes_file' and various other global configuration variables
(including 'editor_program', 'pager_program', 'askpass_program', and
'push_default') have been migrated into the per-repository structure.

* ty/migrate-excludes-file:
  repository: adjust the comment of config_values_private_
  environment: move object_creation_mode into repo_config_values
  environment: move autorebase into repo_config_values
  environment: move push_default into repo_config_values
  environment: migrate apply_default_whitespace and apply_default_ignorewhitespace
  environment: move askpass_program into repo_config_values
  environment: move pager_program into repo_config_values
  environment: move editor_program into repo_config_values
  environment: move excludes_file into repo_config_values
  repository: introduce repo_config_values_clear()
2026-07-23 10:33:51 -07:00
Junio C Hamano 4873f289dd Merge branch 'ty/migrate-trust-executable-bit' into next
The 'trust_executable_bit' (coming from the 'core.filemode'
configuration) has been migrated into 'struct repo_config_values' to
tie it to a specific repository instance.

* ty/migrate-trust-executable-bit:
  environment: move has_symlinks into repo_config_values
  environment: move trust_executable_bit into repo_config_values
  read-cache: pass 'repo' to 'ce_mode_from_stat()'
  read-cache: remove redundant extern declarations
2026-07-23 10:33:51 -07:00
Junio C Hamano 2790c83e45 Merge branch 'hn/history-squash' into next
The experimental 'git history' command has been taught a new 'squash'
subcommand to fold a range of commits into a single commit, with any
descendants replayed on top.

* hn/history-squash:
  history: re-edit a squash with every message
  sequencer: share the squash message marker helpers and flags
  history: add squash subcommand to fold a range
  history: give commit_tree_ext a message template
  history: extract helper for a commit's parent tree
2026-07-23 10:33:51 -07:00
Shlok Kulshreshtha 113d62b141 userdiff: add support for Swift
Add a built-in userdiff driver for the Swift programming language so that
diff hunk headers and word diffs work out of the box for ".swift" files.

The funcname pattern is built for Swift's own declaration grammar: an
optional run of attributes ("@objc", "@available(iOS 13, *)", ...),
followed by an optional run of lowercase modifiers ("public", "static",
"final", ...), followed by a declaration keyword (func, class, struct,
enum, protocol, extension, actor, init, deinit, subscript). The keyword
is followed by a boundary that allows whitespace, "(" (init/subscript),
"?" or "!" (failable init), or "<" (generics), while still acting as a
word boundary so e.g. "initialize(" does not match.

The word regex recognizes Swift identifiers, hexadecimal, octal, binary,
integer and floating-point literals, and the language's operators.

Signed-off-by: Shlok Kulshreshtha <diy2903@gmail.com>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-07-23 07:14:34 -07:00
Junio C Hamano 3f0d502094 Sync with 'master' 2026-07-22 10:31:55 -07:00
Junio C Hamano 1dc394ad9b Merge branch 'hn/bisect-reset-when-found' into next
The 'git bisect' command has been taught a
'--reset-when-found[=<where>]' option that tells the command to
automatically run 'git bisect reset' to jump back to the original
state or to the found culprit.

* hn/bisect-reset-when-found:
  bisect: add --reset-when-found to leave when done
  bisect: let bisect_reset() optionally check out quietly
2026-07-22 10:31:47 -07:00
Junio C Hamano 968a116891 Merge branch 'rs/tempfile-wo-the-repository' into next
The tempfile and lockfile APIs have been refactored to stop depending
on the 'the_repository' global variable, and their callers have been
updated to use the repository-aware variants.

* rs/tempfile-wo-the-repository:
  use repo_hold_lock_file_for_update{,_mode,_timeout}() with custom repos
  tempfile: stop using the_repository
  lockfile: add repo_hold_lock_file_for_update{,_timeout}{,_mode}()
  refs/packed: use repo_create_tempfile()
  tempfile: add repo_create_tempfile{,_mode}()
2026-07-22 10:31:47 -07:00
Junio C Hamano 9a0c4701dc The 7th batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-07-22 10:30:55 -07:00
Junio C Hamano 60aa81f2ef Merge branch 'kk/no-walk-pathspec-fix'
The 'git rev-list --no-walk' command has been corrected to restore
pathspec filtering, which was lost when the streaming walk was
refactored.

* kk/no-walk-pathspec-fix:
  revision: fix --no-walk path filtering regression
2026-07-22 10:30:55 -07:00
Junio C Hamano af4899fbd3 Merge branch 'sk/t7614-do-not-hide-git-exit-status'
The test script 't/t7614-merge-signoff.sh' has been updated to avoid
suppressing the exit code of 'git' commands in a pipe.

* sk/t7614-do-not-hide-git-exit-status:
  t7614: avoid hiding git's exit code in a pipe
2026-07-22 10:30:55 -07:00
Junio C Hamano 2b8f09faec Merge branch 'sk/t1100-modernize'
The test script 't/t1100-commit-tree-options.sh' has been modernized
by converting test cases to the modern style (using single quotes and
tab indentation) and moving the creation of the expected file inside
the setup test so it runs under the protection of the test harness.

* sk/t1100-modernize:
  t1100: move creation of expected output into setup test
  t1100: modernize test style
2026-07-22 10:30:54 -07:00
Junio C Hamano 518368999a Merge branch 'ps/odb-for-each-object-filter'
The object database enumeration interface odb_for_each_object() has
been taught to accept object filters, allowing the underlying backends
to optimize the traversal by using reachability bitmaps when
available.  'git cat-file --batch-all-objects' has been updated to use
this generic interface, simplifying its code and avoiding direct
access to ODB backend internals.

* ps/odb-for-each-object-filter:
  builtin/cat-file: filter objects via object database
  odb: introduce object filters to `odb_for_each_object()`
  pack-bitmap: introduce function to open bitmap for a single source
  pack-bitmap: drop `_1` suffix from functions that open bitmaps
  pack-bitmap: iterate object sources when opening bitmaps
  pack-bitmap: allow aborting iteration of bitmapped objects
  pack-objects: drop unused return value from add_object_entry()
  pack-bitmap: mark object filter as `const`
  odb/source-packed: improve lookup when enumerating objects
2026-07-22 10:30:54 -07:00
Junio C Hamano 88620f05ac Merge branch 'rs/strbuf-avoid-redundant-reset'
A redundant strbuf_reset() call in the 'HAVE_GETDELIM' path of
strbuf_getwholeline() has been removed, as getdelim() overwrites the
buffer and the length is updated afterward.

* rs/strbuf-avoid-redundant-reset:
  strbuf: avoid redundant reset in strbuf_getwholeline()
2026-07-22 10:30:54 -07:00
Junio C Hamano 9822fc38f8 Merge branch 'cc/doc-fast-export-synopsis-fix'
The usage string and SYNOPSIS for 'git fast-export' have been
standardized to make them consistent with each other and with other
commands.

* cc/doc-fast-export-synopsis-fix:
  fast-export: standardize usage string and SYNOPSIS
2026-07-22 10:30:53 -07:00
Junio C Hamano 0a4f81e303 Merge branch 'ml/t9811-replace-test-f'
The test script 't/t9811-git-p4-label-import.sh' has been
modernized to use 'test_path_is_file' and 'test_path_is_missing'
instead of raw 'test -f' and '! test -f' calls.

* ml/t9811-replace-test-f:
  t9811: replace 'test -f' and '! test -f' with 'test_path_*'
  t9811: break long && chains into multiple lines
2026-07-22 10:30:53 -07:00
Junio C Hamano 55f961a555 Merge branch 'jt/receive-pack-use-odb-transactions'
'git receive-pack' has been refactored to use ODB transaction
interfaces instead of directly managing 'tmp_objdir' for staging
incoming objects, bringing it closer to being ODB backend agnostic.

* jt/receive-pack-use-odb-transactions:
  builtin/receive-pack: stage incoming objects via ODB transactions
  builtin/receive-pack: drop redundant tmpdir env
  odb/transaction: introduce ODB transaction flags
  odb/transaction: add transaction env interface
  odb/transaction: propagate commit errors
  odb/transaction: propagate begin errors
  object-file: propagate files transaction errors
  object-file: drop check for inflight transactions
  object-file: embed transaction flush logic in commit function
  object-file: rename files transaction fsync function
  object-file: rename files transaction prepare function
2026-07-22 10:30:53 -07:00
Junio C Hamano ccf9746c67 Merge branch 'cl/conditional-config-on-worktree-path'
The '[includeIf "condition"]' conditional inclusion facility for
configuration files has been taught to use the location of the
worktree in its condition.

* cl/conditional-config-on-worktree-path:
  config: add "worktree" and "worktree/i" includeIf conditions
  config: refactor include_by_gitdir() into include_by_path()
2026-07-22 10:30:53 -07:00
Junio C Hamano aebf83d00a Merge branch 'dm/submodule-update-i-shorthand'
The '-i' shorthand for the '--init' option, which was accepted by the
'git submodule update' command until it was broken in a modernization
of the option-parsing code, has been restored.

* dm/submodule-update-i-shorthand:
  submodule--helper: accept '-i' shorthand for update --init
2026-07-22 10:30:52 -07:00
Junio C Hamano af234c4eb3 Sync with 'master' 2026-07-21 10:24:01 -07:00
Junio C Hamano 51627468a0 Merge branch 'bc/rust-hash-cleanups' into next
A few memory problems in the Rust interface to C hash functions have
been corrected.  The 'Clone' implementation of 'CryptoHasher' now
properly initializes the context before cloning, and its 'Drop'
implementation now discards the context to prevent leaks.

* bc/rust-hash-cleanups:
  rust: discard hash context when finished
  hash: initialize context before cloning
2026-07-21 10:23:51 -07:00
Junio C Hamano 5d2e770923 The 6th batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-07-21 10:18:37 -07:00
Junio C Hamano f1c8bde359 Merge branch 'cl/b4-cover-change-id'
The in-tree 'b4' cover letter template has been updated to include the
'change-id' trailer, ensuring that sent tags generated by 'b4' contain
the required tracking information for subsequent runs.

* cl/b4-cover-change-id:
  b4: include change-id in cover template
2026-07-21 10:18:37 -07:00
Junio C Hamano 9655cb75ff Merge branch 'ps/odb-stream-double-close-fix'
The stream-based object signature verification path has been
corrected to avoid double-closing the stream on read errors.

* ps/odb-stream-double-close-fix:
  object-file: fix closing object stream twice
2026-07-21 10:18:37 -07:00
Junio C Hamano 5475c9f935 Merge branch 'pw/rebase-drop-notes-with-commit' into next
The rebase post-rewrite notes-copying logic has been corrected.  When
a commit is dropped during rebase (e.g., because its changes are
already upstream), it is no longer recorded as rewritten, preventing
its notes from being copied to an unrelated commit.

* pw/rebase-drop-notes-with-commit:
  sequencer: do not record dropped commits as rewritten
  sequencer: use an enum to represent result of picking a commit
  sequencer: simplify pick_one_commit()
  sequencer: remove unnecessary condition in pick_one_commit()
  sequencer: simplify handling of fixup with conflicts
  sequencer: remove unnecessary "or" in pick_one_commit()
  sequencer: never reschedule on failed commit
  sequencer: be more careful with external merge
  t3400: restore coverage for note copying with apply backend
2026-07-20 11:16:43 -07:00
Junio C Hamano 9e38da0efc Merge branch 'ps/copy-wo-the-repository' into next
The 'copy_file()' and 'copy_file_with_time()' functions have been
refactored to take a repository parameter, allowing the removal of the
implicit dependency on the global 'the_repository' variable in
'copy.c'.

* ps/copy-wo-the-repository:
  copy: drop dependency on `the_repository`
2026-07-20 11:16:43 -07:00
Junio C Hamano 9330d42a4a Merge branch 'sc/wt-status-avoid-quadratic-insertion' into next
The enumeration of untracked and ignored files in 'git status' has
been optimized by avoiding quadratic complexity insertion into string
lists, reducing the construction cost from O(n^2) to O(n log n).

* sc/wt-status-avoid-quadratic-insertion:
  wt-status: avoid repeated insertion for untracked paths
2026-07-20 11:16:42 -07:00
Junio C Hamano 31044c3fc9 Merge branch 'ps/refspec-wo-the-repository' into next
The dependency on the global 'the_repository' variable in the
'refspec.c' API has been removed by passing the hash algorithm
explicitly to refspec-parsing functions and storing it in 'struct
refspec'.

* ps/refspec-wo-the-repository:
  refspec: stop depending on `the_repository`
  refspec: let callers pass in hash algorithm when parsing items
  refspec: group related structures and functions
2026-07-20 11:16:42 -07:00
Tian Yuchen df2bc04e69 environment: move has_symlinks into repo_config_values
Move the global 'has_symlinks' configuration into the
repository-specific 'repo_config_values' struct.

Introduce 'repo_has_symlinks()' getter for readability.
Callers access this configuration by passing in 'repo'
when possible, and explicitly fall back to
'the_repository' the rest of the time.

Introduce 'platform_has_symlinks()' macro to allow
platform specific-customization, primarily to help MinGW.
Platforms can override this in their respective headers.

Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Ayush Chandekar <ayu.chandekar@gmail.com>
Mentored-by: Olamide Caleb Bello <belkid98@gmail.com>
Signed-off-by: Tian Yuchen <cat@malon.dev>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-07-20 07:37:05 -07:00
Tian Yuchen 99c79dabb0 environment: move trust_executable_bit into repo_config_values
Move the global 'trust_executable_bit' configuration
into the repository-specific 'repo_config_values'
struct.

To ensure code readability, the getter function
'repo_trust_executable_bit()' has been introduced.
Callers access this configuration by passing in 'repo'
when possible, and explicitly fall back to 'the_repository'
the rest of time.

Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Ayush Chandekar <ayu.chandekar@gmail.com>
Mentored-by: Olamide Caleb Bello <belkid98@gmail.com>
Signed-off-by: Tian Yuchen <cat@malon.dev>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-07-20 07:37:05 -07:00
Tian Yuchen b7b6e9e02f read-cache: pass 'repo' to 'ce_mode_from_stat()'
The ce_mode_from_stat() function is a performance-critical static
inline helper in 'read-cache.h'. As we migrate configuration
variables into the repository struct, this helper needs access
to the repository context.

Update the signature of ce_mode_from_stat() to take a 'struct
repository *' parameter, and update all callers to pass the
appropriate repository instance.

To prepare for the overhead of replacing cheap global variable
accesses with getter functions, the boolean expressions are
reordered to evaluate 'S_ISREG(mode)' first.

While at it, add a comment for ce_mode_from_stat().

Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Ayush Chandekar <ayu.chandekar@gmail.com>
Mentored-by: Olamide Caleb Bello <belkid98@gmail.com>
Signed-off-by: Tian Yuchen <cat@malon.dev>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-07-20 07:37:05 -07:00
Tian Yuchen 8817d7931a read-cache: remove redundant extern declarations
The 'read-cache.c' file already includes 'environment.h', which provides
the extern declarations for variables like 'trust_executable_bit' and
'has_symlinks'.

Remove the redundant extern declarations inside 'st_mode_from_ce()' to
clean up the code.

Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Ayush Chandekar <ayu.chandekar@gmail.com>
Mentored-by: Olamide Caleb Bello <belkid98@gmail.com>
Signed-off-by: Tian Yuchen <cat@malon.dev>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-07-20 07:37:05 -07:00
Harald Nordgren 9a8107a378 history: re-edit a squash with every message
By default "git history squash" reuses the oldest commit's message, or
the replacement body from an amend! commit targeting it. When
--reedit-message is given it only reopened that selected message, so the
messages of the other commits in the range were lost.

Gather the message of every commit in the range and build the same editor
template that "git rebase -i --autosquash" shows for a squash, reusing
add_squash_combination_header(), add_squash_message_header() and
squash_subject_comment_len(). Feed the range through
todo_list_rearrange_squash() so that each fixup!, squash! or amend! is
grouped under the commit it targets rather than shown in commit order,
exactly as autosquash would arrange them.

Only the message text differs, the changes are always folded in. A fixup!
message is commented out in full under a "will be skipped" header, a
squash! keeps its body with only the marker subject commented, and an
amend! replaces its target's message unless a squash! already folded into
that target, in which case it behaves like a squash!.

Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-07-20 07:35:19 -07:00
Harald Nordgren 132e840b4d sequencer: share the squash message marker helpers and flags
When "git rebase -i" squashes commits it builds an editor template with a
"This is a combination of N commits." banner, a "This is the 1st/Nth
commit message:" header above each kept message (or a "will be skipped"
header for a dropped one), and a commented-out subject for any fixup!,
squash! or amend! commit. The banner, the headers and the
subject-commenting all live in static helpers in sequencer.c wired to the
rebase state, so no other command can present a squash the same way.

Pull the three pieces out into add_squash_combination_header(),
add_squash_message_header() (which takes a flag for the "will be skipped"
variant) and squash_subject_comment_len(), and use them from
update_squash_messages() and append_squash_message(). Also move the
todo_item_flags enum to the header, so a caller reading the output of
todo_list_rearrange_squash() can tell an amend! (TODO_REPLACE_FIXUP_MSG)
from a plain fixup!. A later change reuses all of this to give "git
history squash --reedit-message" the same template.

No change in behavior.

Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-07-20 07:35:18 -07:00
Harald Nordgren e439185efd history: add squash subcommand to fold a range
Folding a series of commits into one required either an interactive
rebase where each commit after the first was hand-edited to "fixup", or
a "git reset --soft" to the merge base followed by "git commit --amend".

Add "git history squash <revision-range>" to do this directly. It folds
every commit in the range into the oldest one, keeping that commit's
authorship and taking the tree of the newest commit, then replays the
commits above the range on top. The squashed message comes from the
oldest commit by default, or from the body of the last amend! commit
targeting it. An editor opens with the selected message when
--reedit-message is given. A fixup!, squash! or amend! commit is refused
unless the commit it targets is also in the range, so the fold does not
silently absorb a marker meant for a commit outside it. The check runs
the range through todo_list_rearrange_squash(), which leaves such a
marker as a plain pick. Markers whose target is in the range fold in as
usual. As an exception, a range made up entirely of markers for one
target is combined anyway, taking its message from the last amend! if
there is one, so a batch of fixups for the same commit can be collapsed.

The range is read like the arguments to "git rev-list", so several
revisions such as "HEAD~3..HEAD ^topic" may be given, and rev-list
options are accepted too. As "git replay" does, the walk options the fold
relies on are forced after setup_revisions() and a warning is printed if
an option changed them, so the first commit returned is the range's
oldest and its parent is the base regardless of what the user passed
(including after a "--"). A merge inside the range is folded when its
other parent is reachable from the base, otherwise the range has more
than one base and is rejected. By default the command also refuses when a
ref points at a commit that the fold would discard. Use --update-refs=head
to rewrite only the current branch instead.

Inspired-by: Sergey Chernov <serega.morph@gmail.com>
Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-07-20 07:35:18 -07:00
Harald Nordgren e12b5b74c6 history: give commit_tree_ext a message template
commit_tree_ext() reuses the message of the commit it is handed. A
caller that folds several commits together wants to seed the message
from more than that single commit, so add an optional message_template
parameter. When NULL, the behavior is unchanged.

Pass NULL from the existing fixup and split callers.

Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-07-20 07:35:18 -07:00
Harald Nordgren 88cc922ba5 history: extract helper for a commit's parent tree
Three places resolve the tree of a commit's first parent, falling back
to the empty tree for a root commit, each repeating the same parse and
oidcpy dance. Extract a first_parent_tree_oid() helper and route the
existing callers through it.

No change in behavior.

Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-07-20 07:35:18 -07:00
Harald Nordgren 2f0dacd385 bisect: add --reset-when-found to leave when done
When a bisection finishes, "git bisect" reports the first bad commit
but leaves the session active until "git bisect reset" is run by hand.

Add a "--reset-when-found[=<where>]" option, accepted by both "git
bisect start" and "git bisect run", that resets as soon as the first
bad commit is found. The "original" value returns to the commit checked
out before "git bisect start", while "found" leaves the first bad commit
checked out; omitting the value defaults to "original".

Persist the selected target in a BISECT_RESET_WHEN_FOUND state file
and perform the reset quietly.

For "git bisect run", defer the reset until after the captured output
is printed and BISECT_RUN is closed. This lets cleanup remove the file
on systems that cannot unlink an open file.

Reject this option together with "--no-checkout", since that mode must
not check out either target.

Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-07-20 07:32:22 -07:00
Harald Nordgren 7d7fd5383c bisect: let bisect_reset() optionally check out quietly
Add a "quiet" parameter to bisect_reset() that passes "--quiet" to the
checkout restoring the original HEAD, suppressing its progress and
branch-status output.

No caller sets the flag yet, so behavior is unchanged.

Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-07-20 07:32:22 -07:00
brian m. carlson fdfcd7543e rust: discard hash context when finished
When we allocate a context but then abandon it, we never discard it,
which means that the underlying crypto library context may leak.  This
doesn't happen with our default block code, but it may with OpenSSL.
Note that we do call git_hash_free, which frees the memory we called
from git_hash_alloc, but doesn't discard the underlying context itself.

This can be seen with the following command when compiling with OpenSSL
and running with nightly Rust:

    RUSTFLAGS='-Z sanitizer=leak' cargo test

Discard the context in our context handler.  Note that it is fine to do
so even after finalizing the context, so our final functions which take
self instead of &mut self will not mishandle memory.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-07-19 16:26:09 -07:00
brian m. carlson 251e7af992 hash: initialize context before cloning
Our C-based clone helper requires that the context be initialized, but
we neglect to do that in our Clone implementation for CryptoHasher.
This does not matter when using our default block SHA-256
implementation, but it does cause a crash when using OpenSSL as the
backend.  Fix this by properly initializing the context before cloning
into it.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-07-19 16:26:09 -07:00
Sahitya Chandra 7b2648f745 wt-status: avoid repeated insertion for untracked paths
wt_status_collect_untracked() copies entries from dir.entries and
dir.ignored into string_lists using string_list_insert(). At first glance
this seems quadratic, because inserting into the sorted list may shift the
backing array, incurring O(n) work for each insert.

In practice, though, the entries in the dir struct are already sorted, so
we should not have to shift the array and only pay the O(log n) lookup cost
for each insertion. But this is subtle and depends on the behavior of
fill_directory().

Collect the entries with string_list_append() instead, then sort and
deduplicate each list once with string_list_sort_u(). This preserves the
sorted, duplicate-free result while making the collection strategy explicit.

Signed-off-by: Sahitya Chandra <sahityajb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-07-19 16:21:33 -07:00
Junio C Hamano 1436bc61eb Sync with 'master' 2026-07-19 10:44:01 -07:00
Junio C Hamano ff1b5528ba Merge branch 'rs/remote-curl-simplify-push-specs' into next
The passing of push destination specifications in the 'remote-curl'
helper has been simplified by removing the explicit 'count' parameter
and relying on the NULL-termination of the array.

* rs/remote-curl-simplify-push-specs:
  remote-curl: simplify passing of push specs
2026-07-19 10:43:51 -07:00
Junio C Hamano 5b640e33a1 Merge branch 'td/ref-filter-memoize-contains' into next
'git branch --contains' and 'git for-each-ref --contains' have been
optimized to use the memoized commit traversal previously used only by
'git tag --contains', significantly speeding up connectivity checks
across many candidate refs with shared history.

* td/ref-filter-memoize-contains:
  commit-reach: die on contains walk errors
  ref-filter: memoize --contains with generations
  commit-reach: reject cycles in contains walk
2026-07-19 10:43:51 -07:00
Junio C Hamano 12685f410c Merge branch 'ps/refs-wo-the-repository' into next
The ref subsystem and the worktree API have been refactored to pass a
repository pointer down the call chain, allowing them to drop
references to the global 'the_repository' variable.  As part of this,
the handling of the 'core.packedRefsTimeout' configuration has been
moved into the per-repository ref store structure.

* ps/refs-wo-the-repository:
  refs: remove remaining uses of `the_repository`
  worktree: pass repository to public functions
  worktree: pass repository to file-local functions
  worktree: refactor code to use available repositories
  refs/files: drop `USE_THE_REPOSITORY_VARIABLE`
  refs/packed: de-globalize handling of "core.packedRefsTimeout"
2026-07-19 10:43:51 -07:00
Junio C Hamano b12d5d76f5 Merge branch 'jc/submodule-helper-avoid-zu' into next
An accidental use of '%zu' format flag in 'git submodule--helper'
has been corrected to use 'PRIuMAX' and cast the value to
'uintmax_t', to avoid portability issues.

* jc/submodule-helper-avoid-zu:
  submodule--helper: avoid use of %zu for now
2026-07-19 10:43:50 -07:00
Junio C Hamano bebf13a239 Merge branch 'ps/shift-root-in-graph' into next
'git log --graph' has been modified to visually distinguish parentless
'root' commits (and commits that become roots due to history
simplification) by indenting them, preventing them from appearing
falsely related to unrelated commits rendered immediately above them.

* ps/shift-root-in-graph:
  graph: add --[no-]graph-indent and log.graphIndent
  graph: move config reading into graph_read_config()
  graph: wrap cascading commits after 4 columns
  graph: indent visual root in graph
  graph: add a 2 commit buffer for lookahead
  revision: add next_commit_to_show()
  lib-log-graph: move check_graph function
2026-07-19 10:43:50 -07:00
Junio C Hamano 48bbf81c29 The 5th batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-07-19 10:42:20 -07:00
Junio C Hamano 0b75ef5168 Merge branch 'js/coverity-fixes-null-safety'
Various code paths have been hardened against potential NULL-pointer
dereferences and invalid file descriptor accesses flagged by
Coverity.

* js/coverity-fixes-null-safety:
  shallow: give write_one_shallow() its own hex buffer
  shallow: fix NULL dereference
  bisect: ensure non-NULL `head` before using it
  pack-bitmap: handle missing bitmap for base MIDX
  revision: avoid dereferencing NULL in `add_parents_only()`
  replay: die when --onto does not peel to a commit
  bisect: handle NULL commit in `bisect_successful()`
  mailsplit: move NULL check before first use of file handle
  reftable/stack: guard against NULL list_file in stack_destroy
  remote: guard `remote_tracking()` against NULL remote
  diff: handle NULL return from repo_get_commit_tree()
  diffcore-break: guard against NULLed queue entries in merge loop
2026-07-19 10:42:20 -07:00