79765 Commits

Author SHA1 Message Date
Burak Kaan Karaçay
168d575719 t2003: modernize path existence checks using test helpers
The old style 'test -f' and 'test -d' checks are silent on failure,
which makes debugging difficult.

Replace them with the 'test_path_is_*' helpers which provide verbose
error messages when a test fails.

Signed-off-by: Burak Kaan Karaçay <bkkaracay@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-09 09:46:49 -08:00
René Scharfe
6c21e53bad version: stop using the_repository
Actually it has never been used in version.c since cf7ee48190 (agent:
advertise OS name via agent capability, 2025-02-15) added the dependency
macro.  Remove it, along with the also unused struct declaration.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-08 15:16:49 -08:00
René Scharfe
10c68d2577 remove duplicate includes
The following command reports that some header files are included twice:

   $ git grep '#include' '*.c' | sort | uniq -cd

Remove the second #include line in each case, as it has no effect.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-08 15:03:06 -08:00
René Scharfe
050566633a commit: use commit_stack
Use commit_stack instead of open-coding it.  Also convert the loop
counter i to size_t to match the type of the nr member of struct
commit_stack.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-08 15:02:09 -08:00
Yannik Tausch
8600b4ec9e merge-file: honor merge.conflictStyle outside of a repository
When running outside a repository, git merge-file ignores the
merge.conflictStyle configuration variable entirely. Since the
function receives `repo` from the caller (which is NULL outside a
repository), and repo_config() falls back to reading system and user
configuration when passed NULL, pass `repo` to repo_config()
unconditionally.

Also document that merge.conflictStyle is honored.

Signed-off-by: Yannik Tausch <dev@ytausch.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-07 17:04:26 -08:00
Colin Stagner
c591c3ceff ci: ubuntu: use GNU coreutils for dirname
The uutils version of `dirname` has output that is inconsistent
with GNU coreutils. Prefer the GNU implementation of this command.

Signed-off-by: Colin Stagner <ask+git@howdoi.land>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-06 20:58:44 -08:00
Sam Bostock
fb1b786ebf merge-ours: integrate with sparse-index
The merge-ours built-in opens the index to compare it against HEAD.
The machinery used to do this (i.e. run_diff_index()) is capable of
working with a sparse index, but the start-up sequence of this
command does not take the necessary steps, so we end up expanding the
index fully before doing the comparison.

In order to convince sparse-index.c:is_sparse_index_allowed() to
return true, we need to:

 - Read basic configuration with git_default_config so that global
   variables like core_apply_sparse_checkout are populated.
   merge-ours currently does not read configuration at all.

 - Set command_requires_full_index to 0.

With that, the command can work without expanding the index fully
before doing its work.

Signed-off-by: Sam Bostock <sam@sambostock.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-06 11:45:33 -08:00
Sam Bostock
ba447e9cec merge-ours: drop USE_THE_REPOSITORY_VARIABLE
The merge-ours built-in uses the `the_repository` global to access
the repository. The project is moving away from this global in favor
of the `repo` parameter that is passed to each built-in command.
Since merge-ours is registered with RUN_SETUP, `repo` is guaranteed
to be non-NULL and can be used directly.

Drop the USE_THE_REPOSITORY_VARIABLE macro and use `repo` throughout.

While at it, remove a stray double blank line between the #include
block and the usage string.

Signed-off-by: Sam Bostock <sam@sambostock.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-06 11:45:31 -08:00
SoutrikDas
c44b3f3203 doc: fix repo_config documentation reference
In MyFirstContribution.adoc, the link to the repo_config()
documentation is invalid because the related documentation was moved
to a different file.

Replace the path for the repo_config() documentation from
'Documentation/technical/api-config.h' to 'config.h'.

Signed-off-by: SoutrikDas <valusoutrik@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-06 08:32:13 -08:00
Jean-Noël Avila
a34d1d53a6 doc: convert git-show to synopsis style
* add synopsis block definition in asciidoc.conf.in
 * convert commands to synopsis style
 * use _<placeholder>_ for arguments
 * minor formatting fixes

Reviewed-by: Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>
Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-05 21:14:05 -08:00
Jean-Noël Avila
ccaca2c475 doc: fix some style issues in git-clone and for-each-ref-options
* spell out all forms of --[no-]reject-shallow in git-clone
 * use imperative mood for the first line of options
 * Use asciidoc NOTE macro
 * fix markups

Reviewed-by: Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>
Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-05 21:14:05 -08:00
Jean-Noël Avila
4f29c68534 doc: finalize git-clone documentation conversion to synopsis style
Use backticks where appropriate for command-line options

Reviewed-by: Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>
Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-05 21:14:05 -08:00
Jean-Noël Avila
777f5d089c doc: convert git-submodule to synopsis style
* convert commands to synopsis style
 * use _<placeholder>_ for arguments
 * convert inline lists into proper definition lists
 * minor formatting fixes

Reviewed-by: Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>
Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-05 21:14:05 -08:00
Collin Funk
fc9fd8065c gpg-interface: remove an unnecessary NULL initialization
We assign this variable unconditionally, so we do not need to
initialize it to NULL where it is defined.

Signed-off-by: Collin Funk <collin.funk1@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-05 17:59:19 -08:00
Collin Funk
4ac4705afa global: constify some pointers that are not written to
The recent glibc 2.43 release had the following change listed in its
NEWS file:

    For ISO C23, the functions bsearch, memchr, strchr, strpbrk, strrchr,
    strstr, wcschr, wcspbrk, wcsrchr, wcsstr and wmemchr that return
    pointers into their input arrays now have definitions as macros that
    return a pointer to a const-qualified type when the input argument is
    a pointer to a const-qualified type.

When compiling with GCC 15, which defaults to -std=gnu23, this causes
many warnings like this:

    merge-ort.c: In function ‘apply_directory_rename_modifications’:
    merge-ort.c:2734:36: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
     2734 |                 char *last_slash = strrchr(cur_path, '/');
          |                                    ^~~~~~~

This patch fixes the more obvious ones by making them const when we do
not write to the returned pointer.

Signed-off-by: Collin Funk <collin.funk1@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-05 17:52:49 -08:00
Junio C Hamano
3e0db84c88 Start 2.54 cycle
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-05 15:42:01 -08:00
Junio C Hamano
96614e799c Merge branch 'sp/t5500-cleanup'
Test clean-up.

* sp/t5500-cleanup:
  t5500: simplify test implementation and fix git exit code suppression
2026-02-05 15:42:01 -08:00
Junio C Hamano
7758f84682 Merge branch 'tc/last-modified-options-cleanup'
The "-z" and "--max-depth" documentation (and implementation of
"-z") in the "git last-modified" command have been updated.

* tc/last-modified-options-cleanup:
  last-modified: change default max-depth to 0
  last-modified: document option '--max-depth'
  last-modified: document option '-z'
  last-modified: clarify in the docs the command takes a pathspec
2026-02-05 15:42:01 -08:00
Junio C Hamano
1f17604ce4 Merge branch 'lp/diff-stat-utf8-display-width-fix'
The computation of column width made by "git diff --stat" was
confused when pathnames contain non-ASCII characters.

* lp/diff-stat-utf8-display-width-fix:
  t4073: add test for diffstat paths length when containing UTF-8 chars
  diff: improve scaling of filenames in diffstat to handle UTF-8 chars
2026-02-05 15:42:01 -08:00
Junio C Hamano
d83491aeba Merge branch 'ac/sparse-checkout-string-list-cleanup'
Code clean-up.

* ac/sparse-checkout-string-list-cleanup:
  sparse-checkout: optimize string_list construction and add tests to verify deduplication.
2026-02-05 15:42:00 -08:00
Junio C Hamano
b77c91a49d Merge branch 'sp/myfirstcontribution-include-update'
Doc update.

* sp/myfirstcontribution-include-update:
  doc: MyFirstContribution: fix missing dependencies and clarify build steps
2026-02-05 15:42:00 -08:00
Junio C Hamano
d62717b182 Merge branch 'dd/t5403-modernise'
Test clean-up.

* dd/t5403-modernise:
  t5403: use test_cmp for post-checkout argument checks
  t5403: introduce check_post_checkout helper function
2026-02-05 15:42:00 -08:00
Junio C Hamano
4ae96a4c0e Merge branch 'ap/http-probe-rpc-use-auth'
HTTP transport failed to authenticate in some code paths, which has
been corrected.

* ap/http-probe-rpc-use-auth:
  remote-curl: use auth for probe_rpc() requests too
2026-02-05 15:41:58 -08:00
Junio C Hamano
c3a5261dc0 Merge branch 'ar/submodule-gitdir-tweak'
Avoid local submodule repository directory paths overlapping with
each other by encoding submodule names before using them as path
components.

* ar/submodule-gitdir-tweak:
  submodule: detect conflicts with existing gitdir configs
  submodule: hash the submodule name for the gitdir path
  submodule: fix case-folding gitdir filesystem collisions
  submodule--helper: fix filesystem collisions by encoding gitdir paths
  builtin/credential-store: move is_rfc3986_unreserved to url.[ch]
  submodule--helper: add gitdir migration command
  submodule: allow runtime enabling extensions.submodulePathConfig
  submodule: introduce extensions.submodulePathConfig
  builtin/submodule--helper: add gitdir command
  submodule: always validate gitdirs inside submodule_name_to_gitdir
  submodule--helper: use submodule_name_to_gitdir in add_submodule
2026-02-05 15:41:58 -08:00
Junio C Hamano
ae78735c4b Merge branch 'aa/add-p-previous-decisions'
"git add -p" and friends note what the current status of the hunk
being shown is.

* aa/add-p-previous-decisions:
  add -p: show user's hunk decision when selecting hunks
2026-02-05 15:41:58 -08:00
Junio C Hamano
2b53e8b3ee Merge branch 'jk/remote-tracking-ref-leakfix'
Leakfix.

* jk/remote-tracking-ref-leakfix:
  remote: always allocate branch.push_tracking_ref
  remote: fix leak in branch_get_push_1() with invalid "simple" config
  remote: drop const return of tracking_for_push_dest()
  remote: return non-const pointer from error_buf()
2026-02-05 15:41:57 -08:00
Matěj Cepl
831989ef38 doc: send-email: correct --no-signed-off-by-cc misspelling
There is no option --signed-off-cc (without -by) for git send-email.

Signed-off-by: Matěj Cepl <mcepl@cepl.eu>
[kh: rebased and changed subject to house style]
Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>
[jc: minor copyedit in the commit message]
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-05 11:38:54 -08:00
Junio C Hamano
3c6162ea5c test: optionally test contrib in CI
Recently it was reported that a topic merged to 'next' broke build
and test for contrib/subtree part of the system.

Instead of having those who run 'next' or 'master' to hit the build
and test breakage and report to us, make sure we notice breakages in
contrib/ area before they hit my tree at all, during their own
presubmit testing.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-05 09:26:18 -08:00
Johannes Sixt
ddae547e37 Merge branch 'pks-meson-fix-missing-msgfmt' of https://github.com/pks-gitlab/gitk
* 'pks-meson-fix-missing-msgfmt' of https://github.com/pks-gitlab/gitk:
  gitk: fix msgfmt being required

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2026-02-05 13:45:51 +01:00
Patrick Steinhardt
97121bb017 gitk: fix msgfmt being required
While the Meson build instructions already handle the case where msgfmt
wasn't found, we forgot to mark the dependency itself as optional. This
causes an error in case the executable could not be found:

  Project name: gitk
  Project version: undefined
  Program sh found: YES (C:\Program Files\Git\bin\sh.EXE)
  Program wish found: YES (C:\Program Files\Git\mingw64\bin\wish.EXE)
  Program chmod found: YES (C:\Program Files\Git\usr\bin\chmod.EXE)
  Program mv found: YES (C:\Program Files\Git\usr\bin\mv.EXE)
  Program sed found: YES (C:\Program Files\Git\usr\bin\sed.EXE)
  Program msgfmt found: NO

  subprojects\gitk\meson.build:28:3: ERROR: Program 'msgfmt' not found or not executable

Fix the issue by adding the `required: false` parameter.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
2026-02-05 12:54:03 +01:00
Colin Stagner
486386c687 contrib/subtree: fix tests with reftable backend
One git-subtree test-case relies on git internals to infer the
default branch name. This test fails with the new reftable
backend.

    GIT_TEST_DEFAULT_REF_FORMAT=reftable \
      meson test t7900-subtree

This test script already sets

    GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main

which eliminates the need to infer a branch name at runtime.
Hardcode the branch name.

Signed-off-by: Colin Stagner <ask+git@howdoi.land>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-04 09:33:59 -08:00
Junio C Hamano
0728012c53 diff-highlight: allow testing with Git 3.0 breaking changes
The diff-highlight (in contrib/) comes with its own test script,
which relies on the initial branch name being 'master'.  This is not
just encoded in the test logic, but in the illustration in the file
that shows the topology of the history.

Force the initial branch name to 'master' to allow it pass.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-03 13:27:35 -08:00
Phil Hord
b2826b52eb .mailmap: fix email for Phil Hord
My canonical and old emails were reversed, somehow. Also add
an entry for a new email that may sneak in.

Signed-off-by: Phil Hord <phil.hord@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-03 10:29:00 -08:00
Toon Claes
60614838a4 cocci: extend MEMZERO_ARRAY() rules
Recently the MEMZERO_ARRAY() macro was introduced. In that commit also
coccinelle rules were added to capture cases that can be converted to
use that macro.

Later a few more cases were manually converted to use the macro, but
coccinelle didn't capture those. Extend the rules to capture those as
well.

In various cases the code could be further beautified by removing
parentheses which are no longer needed. Modify the coccinelle rules to
optimize those as well and fix them.

During conversion indentation also used spaces where tabs should be
used, fix that in one go.

Signed-off-by: Toon Claes <toon@iotcl.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-03 09:41:52 -08:00
Kristoffer Haugsbakk
df1c5d7ed7 doc: shortlog: put back trailer paragraphs
47beb37b (shortlog: match commit trailers with --group, 2020-09-27)
added the `trailer` bullet point with three paragraphs.[1] Later,
3dc95e09 (shortlog: support arbitrary commit format `--group`s,
2022-10-24) put the single-paragraph bullet point about `format` right
after the first paragraph about `trailer`. That meant that the second
and third paragraphs for `trailer` got moved to `format`.

Move the two paragraphs back to `trailer`. We now also need one blank
line before the final bullet point so that it does not get joined with
the second bullet point.

† 1: Technically the bullet list formatting was immediately fixed to
     include all three paragraphs in 63d24fa0 (shortlog: allow multiple
     groups to be specified, 2020-09-27)

Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-03 07:36:50 -08:00
Justin Tobler
3f67e3d021 odb: transparently handle common transaction behavior
A new ODB transaction is created and returned via
`odb_transaction_begin()` and stored in the ODB. Only a single
transaction may be pending at a time. If the ODB already has a
transaction, the function is expected to return NULL. Similarly, when
committing a transaction via `odb_transaction_commit()` the transaction
being committed must match the pending transaction and upon commit reset
the ODB transaction to NULL.

These behaviors apply regardless of the ODB transaction implementation.
Move the corresponding logic into `odb_transaction_{begin,commit}()`
accordingly.

Signed-off-by: Justin Tobler <jltobler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-02 17:14:03 -08:00
Justin Tobler
fa7d067923 odb: prepare struct odb_transaction to become generic
An ODB transaction handles how objects are stored temporarily and
eventually committed. Due to object storage being implemented
differently for a given ODB source, the ODB transactions must be
implemented in a manner specific to the source the objects are being
written to. To provide generic transactions, `struct odb_transaction` is
updated to store a commit callback that can be configured to support a
specific ODB source. For now `struct odb_transaction_files` is the
only transaction type and what is always returned when starting a
transaction.

Signed-off-by: Justin Tobler <jltobler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-02 17:14:03 -08:00
Justin Tobler
8bf06d05a5 object-file: rename transaction functions
In a subsequent commit, ODB transactions are made more generic to
facilitate each ODB source providing its own transaction handling.
Rename `object_file_transaction_{begin,commit}()` to
`odb_transaction_files_{begin,commit}()` to better match the future
source specific transaction implementation.

Signed-off-by: Justin Tobler <jltobler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-02 17:14:03 -08:00
Justin Tobler
585e8dfa27 odb: store ODB source in struct odb_transaction
Each `struct odb_transaction` currently stores a reference to the
`struct object_database`. Since transactions are handled per object
source, instead store a reference to the source.

Signed-off-by: Justin Tobler <jltobler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-02 17:14:03 -08:00
René Scharfe
d519082d4e blame: fix coloring for repeated suspects
The option --ignore-rev passes the blame to an older commit.  This can
cause adjacent scoreboard entries to blame the same commit.  Currently
we only look at the present entry when determining whether a line needs
to be colored for --color-lines.  Check the previous entry as well.

Reported-by: Seth McDonald <sethmcmail@pm.me>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-02 13:48:13 -08:00
HodaSalim
68060b9262 t9160:modernize test path checking
Replace old-style path checks with Git's dedicated test helpers:
- test -f → test_path_is_file
- test -d → test_path_is_dir
- test -s → test_file_not_empty

Fix typos with the word "subsequent"

Found using: git grep "test -[efd]" t/

This improves test readability and provides better error messages
when path checks fail.

Signed-off-by: HodaSalim <hoda.s.salim@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-02 11:00:30 -08:00
Abdalrhman Mohamed
2d45507f15 .github/CONTRIBUTING.md: link to SubmittingPatches on git-scm.com
The relative link to SubmittingPatches is broken when viewed through
GitHub's specialized "Contributing" tab. Update the link to point to
the documentation on git-scm.com to be consistent with other links in
the same file. Also, wrap the line to improve readability.

Signed-off-by: Abdalrhman Mohamed <Eng.Abdalrhman.Abdalmonem@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-02 09:56:44 -08:00
Junio C Hamano
67ad42147a Git 2.53
Signed-off-by: Junio C Hamano <gitster@pobox.com>
v2.53.0
2026-02-01 18:15:01 -08:00
Junio C Hamano
6f328bc9e3 Merge tag 'l10n-2.53.0-v1' of https://github.com/git-l10n/git-po
l10n-2.53.0-v1

* tag 'l10n-2.53.0-v1' of https://github.com/git-l10n/git-po:
  l10n: zh_CN: standardize glossary terms
  l10n: zh_CN: updated translation for 2.53
  l10n: zh_CN: fix inconsistent use of standard vs. wide colons
  l10n: fr: v2.53
  l10n: zh_TW.po: update Git 2.53 translation
  l10n: tr: Update Turkish translations
  l10n: sv.po: Update Swedish translation
  l10n: po-id for 2.53
  l10n: ga.po: Fix git-po-helper warnings
  l10n: bg.po: Updated Bulgarian translation (6091t)
  l10n: ga.po: Update Irish translation for Git 2.53
2026-02-01 18:13:52 -08:00
Carlo Marcelo Arenas Belón
239b7f686c RelNotes: fully spell negation
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-01 18:07:39 -08:00
Jiang Xin
532543fa46 Merge branch 'jx/zh_CN' of github.com:jiangxin/git
* 'jx/zh_CN' of github.com:jiangxin/git:
  l10n: zh_CN: standardize glossary terms
  l10n: zh_CN: updated translation for 2.53
  l10n: zh_CN: fix inconsistent use of standard vs. wide colons
2026-01-31 21:32:54 +08:00
Jiang Xin
5a83d800f3 Merge branch 'l10n/zh-TW/git-2-53' of github.com:l10n-tw/git-po
* 'l10n/zh-TW/git-2-53' of github.com:l10n-tw/git-po:
  l10n: zh_TW.po: update Git 2.53 translation
2026-01-31 21:20:06 +08:00
Jiang Xin
e996719801 Merge branch 'po-id' of github.com:bagasme/git-po
* 'po-id' of github.com:bagasme/git-po:
  l10n: po-id for 2.53
2026-01-31 21:15:38 +08:00
Jiang Xin
8ef65d7efd Merge branch 'l10n-ga-2.53' of github.com:aindriu80/git-po
* 'l10n-ga-2.53' of github.com:aindriu80/git-po:
  l10n: ga.po: Fix git-po-helper warnings
  l10n: ga.po: Update Irish translation for Git 2.53
2026-01-31 21:13:55 +08:00
Jiang Xin
b386b3aea7 Merge branch 'master' of github.com:alshopov/git-po
* 'master' of github.com:alshopov/git-po:
  l10n: bg.po: Updated Bulgarian translation (6091t)
2026-01-31 21:11:50 +08:00