From ea39808a22714b8f61b9472de7ef467ced15efea Mon Sep 17 00:00:00 2001 From: Shreyansh Paliwal Date: Fri, 30 Jan 2026 21:01:23 +0530 Subject: [PATCH 1/7] show-index: warn when falling back to SHA-1 outside a repository When 'git show-index' is run outside of a repository and no hashing algorithm is specified via --object-format, it silently falls back to SHA-1, relying on the historical default. This works for existing SHA-1 based index files, but the behavior can be ambiguous and confusing when the input index file uses a different hash algorithm, such as SHA-256. Add a warning when this fallback happens to make the assumption explicit and to guide users toward using --object-format when needed. Signed-off-by: Shreyansh Paliwal Signed-off-by: Junio C Hamano --- builtin/show-index.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/builtin/show-index.c b/builtin/show-index.c index 2c3e2940ce6bb1..45795da2daebaf 100644 --- a/builtin/show-index.c +++ b/builtin/show-index.c @@ -43,11 +43,14 @@ int cmd_show_index(int argc, /* * Fallback to SHA1 if we are running outside of a repository. * - * TODO: Figure out and implement a way to detect the hash algorithm in use by the - * the index file passed in and use that instead. + * TODO: If a future implementation of index file version encodes the hash + * algorithm in its header, enable show-index to infer it from the + * header rather than relying on repository context or a default fallback. */ - if (!the_hash_algo) + if (!the_hash_algo) { + warning(_("assuming SHA-1; use --object-format to override")); repo_set_hash_algo(the_repository, GIT_HASH_DEFAULT); + } hashsz = the_hash_algo->rawsz; From 227e2cc4e1415c4aeadceef527dd33e478ad5ec3 Mon Sep 17 00:00:00 2001 From: Shreyansh Paliwal Date: Fri, 30 Jan 2026 21:01:24 +0530 Subject: [PATCH 2/7] show-index: use gettext wrapping in user facing error messages Multiple 'die()' calls in show-index.c use literal strings directly. Wrap all user-facing 'die()' messages with '_()' so they can be translated via gettext, this ensures better support for users. Signed-off-by: Shreyansh Paliwal Signed-off-by: Junio C Hamano --- builtin/show-index.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/builtin/show-index.c b/builtin/show-index.c index 45795da2daebaf..24f023096777d5 100644 --- a/builtin/show-index.c +++ b/builtin/show-index.c @@ -55,23 +55,23 @@ int cmd_show_index(int argc, hashsz = the_hash_algo->rawsz; if (fread(top_index, 2 * 4, 1, stdin) != 1) - die("unable to read header"); + die(_("unable to read header")); if (top_index[0] == htonl(PACK_IDX_SIGNATURE)) { version = ntohl(top_index[1]); if (version < 2 || version > 2) - die("unknown index version"); + die(_("unknown index version")); if (fread(top_index, 256 * 4, 1, stdin) != 1) - die("unable to read index"); + die(_("unable to read index")); } else { version = 1; if (fread(&top_index[2], 254 * 4, 1, stdin) != 1) - die("unable to read index"); + die(_("unable to read index")); } nr = 0; for (i = 0; i < 256; i++) { unsigned n = ntohl(top_index[i]); if (n < nr) - die("corrupt index file"); + die(_("corrupt index file")); nr = n; } if (version == 1) { @@ -79,7 +79,7 @@ int cmd_show_index(int argc, unsigned int offset, entry[(GIT_MAX_RAWSZ + 4) / sizeof(unsigned int)]; if (fread(entry, 4 + hashsz, 1, stdin) != 1) - die("unable to read entry %u/%u", i, nr); + die(_("unable to read entry %u/%u"), i, nr); offset = ntohl(entry[0]); printf("%u %s\n", offset, hash_to_hex((void *)(entry+1))); } @@ -93,15 +93,15 @@ int cmd_show_index(int argc, ALLOC_ARRAY(entries, nr); for (i = 0; i < nr; i++) { if (fread(entries[i].oid.hash, hashsz, 1, stdin) != 1) - die("unable to read sha1 %u/%u", i, nr); + die(_("unable to read sha1 %u/%u"), i, nr); entries[i].oid.algo = hash_algo_by_ptr(the_hash_algo); } for (i = 0; i < nr; i++) if (fread(&entries[i].crc, 4, 1, stdin) != 1) - die("unable to read crc %u/%u", i, nr); + die(_("unable to read crc %u/%u"), i, nr); for (i = 0; i < nr; i++) if (fread(&entries[i].off, 4, 1, stdin) != 1) - die("unable to read 32b offset %u/%u", i, nr); + die(_("unable to read 32b offset %u/%u"), i, nr); for (i = 0; i < nr; i++) { uint64_t offset; uint32_t off = ntohl(entries[i].off); @@ -110,9 +110,9 @@ int cmd_show_index(int argc, } else { uint32_t off64[2]; if ((off & 0x7fffffff) != off64_nr) - die("inconsistent 64b offset index"); + die(_("inconsistent 64b offset index")); if (fread(off64, 8, 1, stdin) != 1) - die("unable to read 64b offset %u", off64_nr); + die(_("unable to read 64b offset %u"), off64_nr); offset = (((uint64_t)ntohl(off64[0])) << 32) | ntohl(off64[1]); off64_nr++; From 2d45507f15866f5a0755f5983d214116c7b2c05f Mon Sep 17 00:00:00 2001 From: Abdalrhman Mohamed Date: Sun, 1 Feb 2026 02:26:43 +0200 Subject: [PATCH 3/7] .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 Signed-off-by: Junio C Hamano --- .github/CONTRIBUTING.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index c8755e38de81ca..93042128d60d21 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -10,7 +10,8 @@ conveniently send your Pull Requests commits to our mailing list. Please read ["A note from the maintainer"](https://git.kernel.org/pub/scm/git/git.git/plain/MaintNotes?h=todo) to learn how the Git project is managed, and how you can work with it. -In addition, we highly recommend you to read [our submission guidelines](../Documentation/SubmittingPatches). +In addition, we highly recommend you to read +[our submission guidelines](https://git-scm.com/docs/SubmittingPatches). If you prefer video, then [this talk](https://www.youtube.com/watch?v=Q7i_qQW__q4&feature=youtu.be&t=6m4s) might be useful to you as the presenter walks you through the contribution From 68060b92629b29d9d669a91fd37da220175eaaea Mon Sep 17 00:00:00 2001 From: HodaSalim Date: Mon, 2 Feb 2026 18:18:00 +0200 Subject: [PATCH 4/7] t9160:modernize test path checking MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Junio C Hamano --- t/t9160-git-svn-preserve-empty-dirs.sh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/t/t9160-git-svn-preserve-empty-dirs.sh b/t/t9160-git-svn-preserve-empty-dirs.sh index 36c6b1a12ffd95..de32cf2542c617 100755 --- a/t/t9160-git-svn-preserve-empty-dirs.sh +++ b/t/t9160-git-svn-preserve-empty-dirs.sh @@ -61,15 +61,15 @@ test_expect_success 'clone svn repo with --preserve-empty-dirs' ' # "$GIT_REPO"/1 should only contain the placeholder file. test_expect_success 'directory empty from inception' ' - test -f "$GIT_REPO"/1/.gitignore && + test_path_is_file "$GIT_REPO"/1/.gitignore && test $(find "$GIT_REPO"/1 -type f | wc -l) = "1" ' # "$GIT_REPO"/2 and "$GIT_REPO"/3 should only contain the placeholder file. test_expect_success 'directory empty from subsequent svn commit' ' - test -f "$GIT_REPO"/2/.gitignore && + test_path_is_file "$GIT_REPO"/2/.gitignore && test $(find "$GIT_REPO"/2 -type f | wc -l) = "1" && - test -f "$GIT_REPO"/3/.gitignore && + test_path_is_file "$GIT_REPO"/3/.gitignore && test $(find "$GIT_REPO"/3 -type f | wc -l) = "1" ' @@ -77,7 +77,7 @@ test_expect_success 'directory empty from subsequent svn commit' ' # generated for every sub-directory at some point in the repo's history. test_expect_success 'add entry to previously empty directory' ' test $(find "$GIT_REPO"/4 -type f | wc -l) = "1" && - test -f "$GIT_REPO"/4/a/b/c/foo + test_path_is_file "$GIT_REPO"/4/a/b/c/foo ' # The HEAD~2 commit should not have introduced .gitignore placeholder files. @@ -102,14 +102,14 @@ test_expect_success 'clone svn repo with --placeholder-file specified' ' # "$GIT_REPO"/5/.placeholder should be a file, and non-empty. test_expect_success 'placeholder namespace conflict with file' ' - test -s "$GIT_REPO"/5/.placeholder + test_file_not_empty "$GIT_REPO"/5/.placeholder ' # "$GIT_REPO"/6/.placeholder should be a directory, and the "$GIT_REPO"/6 tree # should only contain one file: the placeholder. test_expect_success 'placeholder namespace conflict with directory' ' - test -d "$GIT_REPO"/6/.placeholder && - test -f "$GIT_REPO"/6/.placeholder/.placeholder && + test_path_is_dir "$GIT_REPO"/6/.placeholder && + test_path_is_file "$GIT_REPO"/6/.placeholder/.placeholder && test $(find "$GIT_REPO"/6 -type f | wc -l) = "1" ' @@ -133,19 +133,19 @@ test_expect_success 'second set of svn commits and rebase' ' # Check that --preserve-empty-dirs and --placeholder-file flag state # stays persistent over multiple invocations. -test_expect_success 'flag persistence during subsqeuent rebase' ' - test -f "$GIT_REPO"/7/.placeholder && +test_expect_success 'flag persistence during subsequent rebase' ' + test_path_is_file "$GIT_REPO"/7/.placeholder && test $(find "$GIT_REPO"/7 -type f | wc -l) = "1" ' # Check that placeholder files are properly removed when unnecessary, # even across multiple invocations. -test_expect_success 'placeholder list persistence during subsqeuent rebase' ' - test -f "$GIT_REPO"/1/file1.txt && +test_expect_success 'placeholder list persistence during subsequent rebase' ' + test_path_is_file "$GIT_REPO"/1/file1.txt && test $(find "$GIT_REPO"/1 -type f | wc -l) = "1" && - test -f "$GIT_REPO"/5/file1.txt && - test -f "$GIT_REPO"/5/.placeholder && + test_path_is_file "$GIT_REPO"/5/file1.txt && + test_path_is_file "$GIT_REPO"/5/.placeholder && test $(find "$GIT_REPO"/5 -type f | wc -l) = "2" ' From d519082d4ebf998cd9d10a5ef33544a479e7699c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Sun, 1 Feb 2026 12:47:53 +0100 Subject: [PATCH 5/7] blame: fix coloring for repeated suspects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: René Scharfe Signed-off-by: Junio C Hamano --- builtin/blame.c | 13 +++++++++---- t/t8012-blame-colors.sh | 14 ++++++++++++++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/builtin/blame.c b/builtin/blame.c index 944952e30ebaac..4c946d2cf1eb08 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -461,7 +461,8 @@ static void determine_line_heat(struct commit_info *ci, const char **dest_color) *dest_color = colorfield[i].col; } -static void emit_other(struct blame_scoreboard *sb, struct blame_entry *ent, int opt) +static void emit_other(struct blame_scoreboard *sb, struct blame_entry *ent, + int opt, struct blame_entry *prev_ent) { int cnt; const char *cp; @@ -492,7 +493,10 @@ static void emit_other(struct blame_scoreboard *sb, struct blame_entry *ent, int the_hash_algo->hexsz : (size_t) abbrev; if (opt & OUTPUT_COLOR_LINE) { - if (cnt > 0) { + if (cnt > 0 || + (prev_ent && + oideq(&suspect->commit->object.oid, + &prev_ent->suspect->commit->object.oid))) { color = repeated_meta_color; reset = GIT_COLOR_RESET; } else { @@ -578,7 +582,7 @@ static void emit_other(struct blame_scoreboard *sb, struct blame_entry *ent, int static void output(struct blame_scoreboard *sb, int option) { - struct blame_entry *ent; + struct blame_entry *ent, *prev_ent = NULL; if (option & OUTPUT_PORCELAIN) { for (ent = sb->ent; ent; ent = ent->next) { @@ -600,7 +604,8 @@ static void output(struct blame_scoreboard *sb, int option) if (option & OUTPUT_PORCELAIN) emit_porcelain(sb, ent, option); else { - emit_other(sb, ent, option); + emit_other(sb, ent, option, prev_ent); + prev_ent = ent; } } } diff --git a/t/t8012-blame-colors.sh b/t/t8012-blame-colors.sh index 3d77352650ffb6..5562eba43613ec 100755 --- a/t/t8012-blame-colors.sh +++ b/t/t8012-blame-colors.sh @@ -28,6 +28,20 @@ test_expect_success 'colored blame colors contiguous lines' ' test_line_count = 3 H.expect ' +test_expect_success 'color lines becoming contiguous due to --ignore-rev' ' + mv hello.c hello.orig && + sed "s/ / /g" hello.c && + git add hello.c && + git commit -m"tabs to spaces" && + git -c color.blame.repeatedLines=yellow blame --color-lines --ignore-rev=HEAD hello.c >actual.raw && + test_decode_color actual && + grep "" darkened && + grep "(F" darkened > F.expect && + grep "(H" darkened > H.expect && + test_line_count = 2 F.expect && + test_line_count = 3 H.expect +' + test_expect_success 'color by age consistently colors old code' ' git blame --color-by-age hello.c >actual.raw && git -c blame.coloring=highlightRecent blame hello.c >actual.raw.2 && From df1c5d7ed76e8ff0c49906224cd336875d9f0a66 Mon Sep 17 00:00:00 2001 From: Kristoffer Haugsbakk Date: Tue, 3 Feb 2026 10:48:52 +0100 Subject: [PATCH 6/7] doc: shortlog: put back trailer paragraphs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Kristoffer Haugsbakk Signed-off-by: Junio C Hamano --- Documentation/git-shortlog.adoc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Documentation/git-shortlog.adoc b/Documentation/git-shortlog.adoc index d8ab38dcc1f1a6..146230dc14828e 100644 --- a/Documentation/git-shortlog.adoc +++ b/Documentation/git-shortlog.adoc @@ -64,9 +64,6 @@ OPTIONS example, if your project uses `Reviewed-by` trailers, you might want to see who has been reviewing with `git shortlog -ns --group=trailer:reviewed-by`. - - `format:`, any string accepted by the `--format` option of - 'git log'. (See the "PRETTY FORMATS" section of - linkgit:git-log[1].) + Note that commits that do not include the trailer will not be counted. Likewise, commits with multiple trailers (e.g., multiple signoffs) may @@ -77,6 +74,10 @@ Shortlog will attempt to parse each trailer value as a `name ` identity. If successful, the mailmap is applied and the email is omitted unless the `--email` option is specified. If the value cannot be parsed as an identity, it will be taken literally and completely. + + - `format:`, any string accepted by the `--format` option of + 'git log'. (See the "PRETTY FORMATS" section of + linkgit:git-log[1].) -- + If `--group` is specified multiple times, commits are counted under each From 6fcee4785280a08e7f271bd015a4dc33753e2886 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 11 Feb 2026 11:53:49 -0800 Subject: [PATCH 7/7] The 3rd batch Signed-off-by: Junio C Hamano --- Documentation/RelNotes/2.54.0.adoc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Documentation/RelNotes/2.54.0.adoc b/Documentation/RelNotes/2.54.0.adoc index 59bb58e449b165..7a768bc7dda4f9 100644 --- a/Documentation/RelNotes/2.54.0.adoc +++ b/Documentation/RelNotes/2.54.0.adoc @@ -17,6 +17,8 @@ UI, Workflows & Features * The help text and the documentation for the "--expire" option of "git worktree [list|prune]" have been improved. + * When "git show-index" is run outside a repository, it silently + defaults to SHA-1; the tool now warns when this happens. Performance, Internal Implementation, Development Support etc. @@ -52,9 +54,17 @@ Fixes since v2.53 corrected. (merge eff9299eac kn/ref-batch-output-error-reporting-fix later to maint). + * "git blame --ignore-revs=... --color-lines" did not account for + ignored revisions passing blame to the same commit an adjacent line + gets blamed for. + (merge d519082d4e rs/blame-ignore-colors-fix later to maint). + * Other code cleanup, docfix, build fix, etc. (merge d79fff4a11 jk/remote-tracking-ref-leakfix later to maint). (merge 7a747f972d dd/t5403-modernise later to maint). (merge 81021871ea sp/myfirstcontribution-include-update later to maint). (merge 49223593fd ac/sparse-checkout-string-list-cleanup later to maint). (merge a824421d36 sp/t5500-cleanup later to maint). + (merge df1c5d7ed7 kh/doc-shortlog-fix later to maint). + (merge 2d45507f15 am/doc-github-contributiong-link-to-submittingpatches later to maint). + (merge 68060b9262 hs/t9160-test-paths later to maint).