From: "Ravi Mistry via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
Abhijeetsingh Meena <abhijeet040403@gmail.com>,
Kristoffer Haugsbakk <code@khaugsbakk.name>,
Phillip Wood <phillip.wood@dunelm.org.uk>,
Eric Sunshine <sunshine@sunshineco.com>,
Ravi Mistry <rmistry@google.com>
Subject: [PATCH v3 0/2] blame: ignore revs in HEAD:.git-blame-ignore-revs by default
Date: Sun, 11 Oct 2026 22:21:31 +0000 [thread overview]
Message-ID: <pull.2224.v3.git.1791757294.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.2224.git.1789169384240.gitgitgadget@gmail.com>
This series teaches git-blame(1) and git-annotate(1) to automatically use
the HEAD:.git-blame-ignore-revs blob by default if it exists, so local runs
match hosting platforms without requiring manual blame.ignoreRevsFile
configuration in every clone. This restarts the stalled attempt in PR
https://github.com/gitgitgadget/git/pull/1809
(https://lore.kernel.org/git/pull.1809.v2.git.1728707867.gitgitgadget@gmail.com/)
and addresses https://github.com/gitgitgadget/git/issues/1494.
Changes since v2:
* Patch 2/2 uses sb->repo instead of the_repository in
parse_default_ignore_revs_blob().
Changes since v1:
* Split the series into two commits.
* Patch 1/2 hardens oidset_parse_file_carefully() in oidset.c and
peel_to_commit_oid() in builtin/blame.c before exposing them to
upstream-controlled content at a well-known path:
* Reject lines containing embedded NUL bytes via memchr() so trailing
bytes after a NUL cannot be silently ignored.
* Pass OBJECT_INFO_LOOKUP_REPLACE | OBJECT_INFO_SKIP_FETCH_OBJECT |
OBJECT_INFO_QUICK to odb_read_object_info_extended() and peel tags one
layer per iteration so missing OIDs or tag targets do not trigger lazy
promisor fetches or pack directory rescans in partial clones, and
verify that each peeled target matches the tag's declared type.
* Patch 2/2 reads the committed HEAD:.git-blame-ignore-revs blob (in both
bare and non-bare repositories) instead of reading a file from the
working tree, matching hosting platforms even when an untracked file is
present or a tracked one has local modifications. The tree entry is
checked with S_ISREG() so non-regular entries (such as committed
symlinks) are skipped, parsed in memory via
oidset_parse_buffer_carefully(), and bypassed without reading if cleared
via blame.ignoreRevsFile="" or --no-ignore-revs-file.
Ravi Mistry (2):
blame: harden ignore-revs parser and tag peeling
blame: ignore revs in HEAD:.git-blame-ignore-revs
Documentation/blame-options.adoc | 8 +-
Documentation/config/blame.adoc | 9 +-
builtin/blame.c | 65 ++++++++-
oidset.c | 81 ++++++++----
oidset.h | 9 ++
t/t8013-blame-ignore-revs.sh | 220 +++++++++++++++++++++++++++++++
6 files changed, 357 insertions(+), 35 deletions(-)
base-commit: fa7f9290efe2bd22dd736689597b474b93798e11
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2224%2Frmistry%2Fblame-default-ignore-revs-v3
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2224/rmistry/blame-default-ignore-revs-v3
Pull-Request: https://github.com/gitgitgadget/git/pull/2224
Range-diff vs v2:
1: 2e12486c0d = 1: 2e12486c0d blame: harden ignore-revs parser and tag peeling
2: 35e303d65b ! 2: 72a87d1c34 blame: ignore revs in HEAD:.git-blame-ignore-revs
@@ builtin/blame.c: static int peel_to_commit_oid(struct object_id *oid_ret, void *
+ size_t size;
+ char *buf;
+
-+ if (get_oid_with_context(the_repository, name, GET_OID_QUIETLY,
++ if (get_oid_with_context(sb->repo, name, GET_OID_QUIETLY,
+ &oid, &oc))
+ goto out;
+ if (!S_ISREG(oc.mode))
+ goto out;
+
-+ buf = odb_read_object(the_repository->objects, &oid, &type, &size);
++ buf = odb_read_object(sb->repo->objects, &oid, &type, &size);
+ if (!buf)
+ goto out;
+ if (type == OBJ_BLOB)
+ oidset_parse_buffer_carefully(&sb->ignore_list, buf, size,
-+ the_repository->hash_algo,
++ sb->repo->hash_algo,
+ peel_to_commit_oid, sb);
+ free(buf);
+
--
gitgitgadget
next prev parent reply other threads:[~2026-10-11 22:21 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-11 23:29 [PATCH] blame: default to ignoring revisions in .git-blame-ignore-revs Ravi Mistry via GitGitGadget
2026-09-30 14:59 ` Ravi Mistry
2026-10-05 15:37 ` Junio C Hamano
2026-10-05 21:12 ` Ravi Mistry
2026-10-07 17:43 ` Junio C Hamano
2026-10-07 18:07 ` Ravi Mistry
2026-10-08 21:07 ` [PATCH v2 0/2] blame: ignore revs in HEAD:.git-blame-ignore-revs by default Ravi Mistry via GitGitGadget
2026-10-08 21:07 ` [PATCH v2 1/2] blame: harden ignore-revs parser and tag peeling Ravi Mistry via GitGitGadget
2026-10-09 5:07 ` Junio C Hamano
2026-10-10 19:25 ` Ravi Mistry
2026-10-08 21:07 ` [PATCH v2 2/2] blame: ignore revs in HEAD:.git-blame-ignore-revs Ravi Mistry via GitGitGadget
2026-10-09 20:17 ` Junio C Hamano
2026-10-10 6:12 ` Eric Sunshine
2026-10-10 18:40 ` Ravi Mistry
2026-10-11 18:58 ` Junio C Hamano
2026-10-11 22:29 ` Ravi Mistry
2026-10-11 23:07 ` Junio C Hamano
2026-10-11 22:21 ` Ravi Mistry via GitGitGadget [this message]
2026-10-11 22:21 ` [PATCH v3 1/2] blame: harden ignore-revs parser and tag peeling Ravi Mistry via GitGitGadget
2026-10-11 22:21 ` [PATCH v3 2/2] blame: ignore revs in HEAD:.git-blame-ignore-revs Ravi Mistry via GitGitGadget
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=pull.2224.v3.git.1791757294.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=abhijeet040403@gmail.com \
--cc=code@khaugsbakk.name \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=phillip.wood@dunelm.org.uk \
--cc=rmistry@google.com \
--cc=sunshine@sunshineco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox