git: 8ae306a1c8eb - main - git-mfc: Add an ignore-list feature
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 10 Jul 2026 21:23:09 UTC
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=8ae306a1c8eb919ca087cd20dc03e1d5a083abd6
commit 8ae306a1c8eb919ca087cd20dc03e1d5a083abd6
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-07-10 20:26:14 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-07-10 21:21:59 +0000
git-mfc: Add an ignore-list feature
Commit hashes listed in ~/.git-mfc-ignore are not listed in output of
git-mfc --dangling or --pending. This is handy for silencing output
about commits that are tagged for MFC or as fixing another commit, but
which were not MFCed for some reason or other.
Requested by: des
Reviewed by: des
Differential Revision: https://reviews.freebsd.org/D58161
---
tools/tools/git/git-mfc | 31 +++++++++++++++++++++++++++++++
tools/tools/git/git-mfc.1 | 14 ++++++++++++++
2 files changed, 45 insertions(+)
diff --git a/tools/tools/git/git-mfc b/tools/tools/git/git-mfc
index 42fb4f169412..7040443bea1b 100755
--- a/tools/tools/git/git-mfc
+++ b/tools/tools/git/git-mfc
@@ -250,6 +250,31 @@ def mfc_origins(repo, commit, warn=False):
return origins
+def load_ignore_list(repo):
+ """
+ Load commit hashes from $HOME/.git-mfc-ignore. Each line has the format:
+ <commit-hash> [ignored text]
+ where the hash may be abbreviated. Blank lines and lines starting with
+ '#' are skipped. Each hash is resolved to a full commit to validate it.
+ """
+ path = os.path.join(os.environ['HOME'], '.git-mfc-ignore')
+ commits = set()
+ try:
+ with open(path) as f:
+ for lineno, line in enumerate(f, 1):
+ line = line.strip()
+ if not line or line.startswith('#'):
+ continue
+ abbrev = line.split()[0]
+ try:
+ commits.add(repo.commit(abbrev).hexsha)
+ except (git.exc.BadName, ValueError):
+ err(1, f"{path}:{lineno}: unknown commit {abbrev}")
+ except FileNotFoundError:
+ pass
+ return commits
+
+
def dangling(repo, upstream, author=None, committer=None):
"""
Find commits in the current branch which have been cherry-picked from
@@ -478,13 +503,19 @@ def main():
err(1, "could not determine user email; use -c or --all")
if args.dangling:
+ ignored = load_ignore_list(repo)
missing = dangling(repo, upstream, author=author, committer=committer)
for fixup, commit in missing:
+ if fixup.hexsha in ignored:
+ continue
print(f'{commit_summary(fixup)} fixes {commit_summary(commit)}')
elif args.pending:
+ ignored = load_ignore_list(repo)
results = pending(repo, upstream, author=author, committer=committer,
baking=args.baking)
for commit, ready_date, ready in results:
+ if commit.hexsha in ignored:
+ continue
date_str = ready_date.strftime('%Y-%m-%d')
if ready:
status = f"ready since {date_str}"
diff --git a/tools/tools/git/git-mfc.1 b/tools/tools/git/git-mfc.1
index 2594446201c2..9121c253f3a9 100644
--- a/tools/tools/git/git-mfc.1
+++ b/tools/tools/git/git-mfc.1
@@ -287,6 +287,20 @@ Use a different remote and origin branch:
.Bd -literal -offset indent
$ git mfc -r freebsd --origin main abc123
.Ed
+.Sh FILES
+.Bl -tag -width "$HOME/.git-mfc-ignore"
+.It Pa $HOME/.git-mfc-ignore
+A list of commits to exclude from
+.Fl -pending
+and
+.Fl -dangling
+output.
+Each line contains a commit hash, optionally abbreviated, followed by
+arbitrary text which is ignored.
+Blank lines and lines beginning with
+.Ql #
+are skipped.
+.El
.Sh SEE ALSO
.Xr git-cherry-pick 1 ,
.Xr git-config 1 ,