Commit Graph

79985 Commits

Author SHA1 Message Date
Junio C Hamano
6a23eb7fc3 Merge branch 'pw/commit-msg-sample-hook' into next
Update sample commit-msg hook to complain when a log message has
material mailinfo considers the end of log message in the middle.

* pw/commit-msg-sample-hook:
  templates: detect commit messages containing diffs
  templates: add .gitattributes entry for sample hooks
2026-02-17 13:36:42 -08:00
Junio C Hamano
1d285c8824 Sync with 'master' 2026-02-13 13:47:21 -08:00
Junio C Hamano
a9746d98e4 Merge branch 'ak/t9812-test-path-is-helpers' into next
Test update.

* ak/t9812-test-path-is-helpers:
  t9812: modernize test path helpers
2026-02-13 13:47:13 -08:00
Junio C Hamano
a8e8191f03 Merge branch 'pw/diff-anchored-optim' into next
"git diff --anchored=<text>" has been optimized.

* pw/diff-anchored-optim:
  diff --anchored: avoid checking unmatched lines
2026-02-13 13:47:13 -08:00
Junio C Hamano
8850dc2fa9 Merge branch 'kh/doc-am-format-sendmail' into next
Doc update.

* kh/doc-am-format-sendmail:
  doc: add caveat about round-tripping format-patch
2026-02-13 13:47:12 -08:00
Junio C Hamano
852829b3dd The 4th batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-13 13:39:26 -08:00
Junio C Hamano
03dfe4e1af Merge branch 'sb/merge-ours-sparse'
"git merge-ours" is taught to work better in a sparse checkout.

* sb/merge-ours-sparse:
  merge-ours: integrate with sparse-index
  merge-ours: drop USE_THE_REPOSITORY_VARIABLE
2026-02-13 13:39:26 -08:00
Junio C Hamano
94336d77bc Merge branch 'sd/doc-my1c-api-config-reference-fix'
Docfix.

* sd/doc-my1c-api-config-reference-fix:
  doc: fix repo_config documentation reference
2026-02-13 13:39:26 -08:00
Junio C Hamano
e10d5fcad0 Merge branch 'jc/ci-test-contrib-too'
Test contrib/ things in CI to catch breakages before they enter the
"next" branch.

* jc/ci-test-contrib-too:
  : Some of our downstream folks run more tests than we do and catch
  : breakages in them, namely, where contrib/*/Makefile has "test" target.
  : Let's make sure we fail upon accepting a new topic that break them in
  : 'seen'.
  ci: ubuntu: use GNU coreutils for dirname
  test: optionally test contrib in CI
2026-02-13 13:39:26 -08:00
Junio C Hamano
29722ee3a3 Merge branch 'jt/odb-transaction-per-source'
Transaction to create objects (or not) is currently tied to the
repository, but in the future a repository can have multiple object
sources, which may have different transaction mechanisms.  Make the
odb transaction API per object source.

* jt/odb-transaction-per-source:
  odb: transparently handle common transaction behavior
  odb: prepare `struct odb_transaction` to become generic
  object-file: rename transaction functions
  odb: store ODB source in `struct odb_transaction`
2026-02-13 13:39:26 -08:00
Junio C Hamano
5288202433 Merge branch 'ps/commit-list-functions-renamed'
Rename three functions around the commit_list data structure.

* ps/commit-list-functions-renamed:
  commit: rename `free_commit_list()` to conform to coding guidelines
  commit: rename `reverse_commit_list()` to conform to coding guidelines
  commit: rename `copy_commit_list()` to conform to coding guidelines
2026-02-13 13:39:25 -08:00
Junio C Hamano
70cc3bca87 Merge branch 'tc/last-modified-not-a-tree'
Giving "git last-modified" a tree (not a commit-ish) died an
uncontrolled death, which has been corrected.

* tc/last-modified-not-a-tree:
  last-modified: verify revision argument is a commit-ish
  last-modified: remove double error message
  last-modified: fix memory leak when more than one commit is given
  last-modified: rewrite error message when more than one commit given
2026-02-13 13:39:25 -08:00
Junio C Hamano
f036245819 Merge branch 'mc/doc-send-email-signed-off-by-cc'
Docfix.

* mc/doc-send-email-signed-off-by-cc:
  doc: send-email: correct --no-signed-off-by-cc misspelling
2026-02-13 13:39:25 -08:00
Junio C Hamano
7855effc95 Merge branch 'cf/c23-const-preserving-strchr-updates-0'
ISO C23 redefines strchr and friends that tradiotionally took
a const pointer and returned a non-const pointer derived from it to
preserve constness (i.e., if you ask for a substring in a const
string, you get a const pointer to the substring).  Update code
paths that used non-const pointer to receive their results that did
not have to be non-const to adjust.

* cf/c23-const-preserving-strchr-updates-0:
  gpg-interface: remove an unnecessary NULL initialization
  global: constify some pointers that are not written to
2026-02-13 13:39:25 -08:00
Junio C Hamano
a91de2172d Merge branch 'jc/diff-highlight-main-master-testfix'
Test fix (in contrib/)

* jc/diff-highlight-main-master-testfix:
  diff-highlight: allow testing with Git 3.0 breaking changes
2026-02-13 13:39:24 -08:00
Junio C Hamano
448a65c93b Merge branch 'cs/subtree-reftable-testfix'
Test fix (in contrib/)

* cs/subtree-reftable-testfix:
  contrib/subtree: fix tests with reftable backend
2026-02-13 13:39:24 -08:00
Junio C Hamano
b852412523 Merge branch 'tc/memzero-array'
Coccinelle rules update.

* tc/memzero-array:
  cocci: extend MEMZERO_ARRAY() rules
2026-02-13 13:39:24 -08:00
Phillip Wood
83804c361b templates: detect commit messages containing diffs
If the body of a commit message contains a diff that is not indented
then "git am" will treat that diff as part of the patch rather than
as part of the commit message. This allows it to apply email messages
that were created by adding a commit message in front of a regular diff
without adding the "---" separator used by "git format-patch". This
often surprises users [1-4] so add a check to the sample "commit-msg"
hook to reject messages that would confuse "git am". Even if a project
does not use an email based workflow it is not uncommon for people
to generate patches from it and apply them with "git am". Therefore
it is still worth discouraging the creation of commit messages that
would not be applied correctly.

A further source of confusion when applying patches with "git am" is
the "---" separator that is added by "git format patch". If a commit
message body contains that line then it will be truncated by "git am".
As this is often used by patch authors to add some commentary that
they do not want to end up in the commit message when the patch is
applied, the hook does not complain about the presence of "---" lines
in the message.

Detecting if the message contains a diff is complicated by the
hook being passed the message before it is cleaned up so we need to
ignore any diffs below the scissors line. There are also two possible
config keys to check to find the comment character at the start of
the scissors line. The first paragraph of the commit message becomes
the email subject header which beings "Subject: " and so does not
need to be checked. The trailing ".*" when matching commented lines
ensures that if the comment string ends with a "$" it is not treated
as an anchor.

[1] https://lore.kernel.org/git/bcqvh7ahjjgzpgxwnr4kh3hfkksfruf54refyry3ha7qk7dldf@fij5calmscvm
[2] https://lore.kernel.org/git/ca13705ae4817ffba16f97530637411b59c9eb19.camel@scientia.org/
[3] https://lore.kernel.org/git/d0b577825124ac684ab304d3a1395f3d2d0708e8.1662333027.git.matheus.bernardino@usp.br/
[4] https://lore.kernel.org/git/CAFOYHZC6Qd9wkoWPcTJDxAs9u=FGpHQTkjE-guhwkya0DRVA6g@mail.gmail.com/

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-13 09:26:11 -08:00
Phillip Wood
046e1117d5 templates: add .gitattributes entry for sample hooks
The sample hooks are shell scripts but the filenames end with ".sample"
so they need their own .gitattributes rule. Update our editorconfig
settings to match the attributes as well.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-13 09:26:11 -08:00
Kristoffer Haugsbakk
a454cdca42 doc: add caveat about round-tripping format-patch
git-format-patch(1) and git-am(1) deal with formatting commits as
patches and applying them, respectively. Naturally they use a few
delimiters to mark where the commit message ends. This can lead to
surprising behavior when these delimiters are used in the commit
message itself.

git-format-patch(1) will accept any commit message and not warn or error
about these delimiters being used.[1]

Especially problematic is the presence of unindented diffs in the commit
message; the patch machinery will naturally (since the commit message
has ended) try to apply that diff and everything after it.[2]

It is unclear whether any commands in this chain will learn to warn
about this. One concern could be that users have learned to rely on
the three-dash line rule to conveniently add extra-commit message
information in the commit message, knowing that git-am(1) will
ignore it.[4]

All of this is covered already, technically. However, we should spell
out the implications.

† 1: There is also git-commit(1) to consider. However, making that
     command warn or error out over such delimiters would be disruptive
     to all Git users who never use email in their workflow.
† 2: Recently patch(1) caused this issue for a project, but it was noted
     that git-am(1) has the same behavior[3]
† 3: https://github.com/i3/i3/pull/6564#issuecomment-3858381425
† 4: https://lore.kernel.org/git/xmqqldh4b5y2.fsf@gitster.g/
     https://lore.kernel.org/git/V3_format-patch_caveats.354@msgid.xyz/

Reported-by: Matthias Beyer <mail@beyermatthias.de>
Reported-by: Christoph Anton Mitterer <calestyo@scientia.org>
Reported-by: Matheus Tavares <matheus.tavb@gmail.com>
Reported-by: Chris Packham <judge.packham@gmail.com>
Helped-by: Jakob Haufe <sur5r@sur5r.net>
Helped-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-12 14:37:56 -08:00
Junio C Hamano
d1286b26eb Merge branch 'jc/doc-cg-c-comment' into next
A CodingGuidelines update.

* jc/doc-cg-c-comment:
  CodingGuidelines: document // comments
2026-02-12 13:42:22 -08:00
Ashwani Kumar Kamal
580d86576a t9812: modernize test path helpers
Replace assertion-style 'test -f' checks with Git's
test_path_is_file() helper for clearer failures and
consistency.

Signed-off-by: Ashwani Kumar Kamal <ashwanikamal.im421@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-12 11:08:29 -08:00
Phillip Wood
dd2a4c0c7a diff --anchored: avoid checking unmatched lines
For a line to be an anchor it has to appear in each of the files being
diffed exactly once. With that in mind lets delay checking whether
a line is an anchor until we know there is exactly one instance of
the line in each file. As each line is checked at most once, there
is no need to cache the result of is_anchor() and we can drop that
field from the hashmap entries. When diffing 5000 recent commits in
git.git this gives a modest speedup of ~2%. In the (rather extreme)
example below that consists largely of deletions the speedup is ~16%.

    seq 0 10000000 >old
    printf '%s\n' 300000 100000 200000 >new
    git diff --no-index --anchored=300000 old new

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-12 09:28:49 -08:00
Junio C Hamano
5ff8915fb3 Sync with 'master' 2026-02-11 14:54:28 -08:00
Junio C Hamano
453e7b744a Merge branch 'master' of https://github.com/j6t/gitk
* 'master' of https://github.com/j6t/gitk:
  gitk: fix msgfmt being required
  gitk: fix highlighted remote prefix of branches with directories
2026-02-11 14:49:53 -08:00
Junio C Hamano
2f99f50f2d CodingGuidelines: document // comments
We do not use // comments in our C code, which is implied by the
description of multi-line comment rule and its examples, but is not
explicitly spelled out.  Spell it out.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-11 13:29:36 -08:00
Junio C Hamano
96ddfc5eaa Sync with 'master' 2026-02-11 12:31:24 -08:00
Junio C Hamano
e6df42d605 Merge branch 'pw/xdiff-cleanups' into next
Small clean-up of xdiff library to remove unnecessary data
duplication.

* pw/xdiff-cleanups:
  xdiff: remove unused data from xdlclass_t
  xdiff: remove "line_hash" field from xrecord_t
2026-02-11 12:31:03 -08:00
Junio C Hamano
6fcee47852 The 3rd batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-11 12:29:08 -08:00
Junio C Hamano
06cef761b1 Merge branch 'rs/blame-ignore-colors-fix'
"git blame --ignore-revs=... --color-lines" did not account for
ignored revisions passing blame to the same commit an adjacent line
gets blamed for.

* rs/blame-ignore-colors-fix:
  blame: fix coloring for repeated suspects
2026-02-11 12:29:08 -08:00
Junio C Hamano
ea03b35bb5 Merge branch 'hs/t9160-test-paths'
Test update.

* hs/t9160-test-paths:
  t9160:modernize test path checking
2026-02-11 12:29:07 -08:00
Junio C Hamano
18df0fa3ca Merge branch 'am/doc-github-contributiong-link-to-submittingpatches'
GitHub repository banner update.

* am/doc-github-contributiong-link-to-submittingpatches:
  .github/CONTRIBUTING.md: link to SubmittingPatches on git-scm.com
2026-02-11 12:29:07 -08:00
Junio C Hamano
40c59964b3 Merge branch 'kh/doc-shortlog-fix'
Doc fix.

* kh/doc-shortlog-fix:
  doc: shortlog: put back trailer paragraphs
2026-02-11 12:29:07 -08:00
Junio C Hamano
cf5b37fb43 Merge branch 'sp/show-index-warn-fallback'
When "git show-index" is run outside a repository, it silently
defaults to SHA-1; the tool now warns when this happens.

* sp/show-index-warn-fallback:
  show-index: use gettext wrapping in user facing error messages
  show-index: warn when falling back to SHA-1 outside a repository
2026-02-11 12:29:06 -08:00
Junio C Hamano
19a08e0c02 Revert "Merge branch 'ps/ci-gitlab-msvc-updates' into next"
This reverts commit 378f67d678, reversing
changes made to 5e3bc9f2b9.

Direct arithmetic operations (like +, -, *, /) are not directly
supported within GitHub Actions expressions inside ${{ ... }}
syntax.

Invalid workflow file: .github/workflows/main.yml#L1
(Line: 153, Col: 12): Unexpected symbol: '+'. Located at position 11
within expression: matrix.nr + 1, (Line: 301, Col: 12): Unexpected
symbol: '+'. Located at position 11 within expression: matrix.nr + 1
2026-02-10 14:10:48 -08:00
Junio C Hamano
88a6c151d7 Merge branch 'jc/doc-rerere-update' into next
Doc update.

* jc/doc-rerere-update:
  rerere: minor documantation update
2026-02-10 12:40:06 -08:00
Junio C Hamano
378f67d678 Merge branch 'ps/ci-gitlab-msvc-updates' into next
CI update.

* ps/ci-gitlab-msvc-updates:
  gitlab-ci: handle failed tests on MSVC+Meson job
  gitlab-ci: use "run-test-slice-meson.sh"
  ci: make test slicing consistent across Meson/Make
  ci: don't skip smallest test slice in GitLab
  ci: handle failures of test-slice helper
2026-02-10 12:40:05 -08:00
Junio C Hamano
5e3bc9f2b9 Merge branch 'sd/t7003-test-path-is-helpers' into next
Test updates.

* sd/t7003-test-path-is-helpers:
  t7003: modernize path existence checks using test helpers
2026-02-10 12:40:05 -08:00
Junio C Hamano
1ade94535a Merge branch 'kh/doc-rerere-options-xref' into next
Doc update.

* kh/doc-rerere-options-xref:
  doc: rerere-options.adoc: link to git-rerere(1)
2026-02-10 12:40:05 -08:00
Junio C Hamano
561a73205e Merge branch 'bk/t2003-modernise' into next
Test update.

* bk/t2003-modernise:
  t2003: modernize path existence checks using test helpers
2026-02-10 12:40:05 -08:00
Junio C Hamano
c1a50b2859 Merge branch 'rs/commit-commit-stack' into next
Code clean-up to use the commit_stack API.

* rs/commit-commit-stack:
  commit: use commit_stack
2026-02-10 12:40:04 -08:00
Junio C Hamano
883d07f2eb Merge branch 'rs/clean-includes' into next
Clean up redundant includes of header files.

* rs/clean-includes:
  remove duplicate includes
2026-02-10 12:40:04 -08:00
Junio C Hamano
dbb8a23008 Merge branch 'rs/xdiff-wo-the-repository' into next
Reduce dependency on the_repository of xdiff-interface layer.

* rs/xdiff-wo-the-repository:
  xdiff-interface: stop using the_repository
2026-02-10 12:40:04 -08:00
Junio C Hamano
80809d2b3d Merge branch 'rs/version-wo-the-repository' into next
Code clean-up.

* rs/version-wo-the-repository:
  version: stop using the_repository
2026-02-10 12:40:04 -08:00
Junio C Hamano
ee1ced4120 Merge branch 'yt/merge-file-outside-a-repository' into next
"git merge-file" can be run outside a repository, but it ignored
all configuration, even the per-user ones.  The command now uses
available configuration files to find its customization.

* yt/merge-file-outside-a-repository:
  merge-file: honor merge.conflictStyle outside of a repository
2026-02-10 12:40:04 -08:00
Kristoffer Haugsbakk
6bfef81c9a doc: rerere-options.adoc: link to git-rerere(1)
Five commands include these options. Let’s link to the command so that
the curious user can learn more about what “rerere” is about.

It’s also better to consistently refer to things like
e.g. “git-subcommand(1)” over `git subcommand` or `subcommand`.

Also apply the same treatment to git-add(1).

Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-10 12:27:07 -08:00
René Scharfe
af5706f033 xdiff-interface: stop using the_repository
Use the algorithm-agnostic is_null_oid() and push the dependency of
read_mmblob() on the_repository->objects to its callers.  This allows it
to be used with arbitrary object databases.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-10 08:16:14 -08:00
Junio C Hamano
728cabbaf7 Sync with 'master' 2026-02-09 12:11:54 -08:00
Junio C Hamano
d732b9d6a0 Merge branch 'ja/doc-synopsis-style-even-more' into next
A handful of documentation pages have been modernized to use the
"synopsis" style.

* ja/doc-synopsis-style-even-more:
  doc: convert git-show to synopsis style
  doc: fix some style issues in git-clone and for-each-ref-options
  doc: finalize git-clone documentation conversion to synopsis style
  doc: convert git-submodule to synopsis style
2026-02-09 12:11:44 -08:00
Junio C Hamano
87bfa08d16 Merge branch 'pc/lockfile-pid' into next
Allow recording process ID of the process that holds the lock next
to a lockfile for diagnosis.

* pc/lockfile-pid:
  lockfile: add PID file for debugging stale locks
2026-02-09 12:11:44 -08:00