From 5ad119d1482ed776a1f56e03f766a2eaa067dd49 Mon Sep 17 00:00:00 2001 From: Lasse Server Date: Mon, 3 Aug 2026 09:29:57 +0200 Subject: [PATCH] Fix upstream-pending: use git --grep instead of shell parsing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The first version read git log through a shell while-loop with a tab IFS, which make mangled — every commit came out as an 'ambiguous argument' error. git's own --grep and --invert-grep search the full commit message, including the trailer, and need no parsing at all. Upstream: no — tooling for forks. --- Makefile | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 14669e6..ed827fa 100644 --- a/Makefile +++ b/Makefile @@ -46,14 +46,10 @@ check-fork-divergence: ## Verify the fork differs from upstream only under deplo echo "Fork is clean: no differences outside deploy/prod/."; \ fi -upstream-pending: ## For a fork: list local commits marked "Upstream: yes" that upstream lacks +upstream-pending: ## For a fork: list local commits owed upstream @git fetch --quiet upstream 2>/dev/null || { echo "No 'upstream' remote."; exit 1; } - @echo "Marked for upstream, not yet there:" - @git log --format='%h %s%n%b' upstream/main..HEAD 2>/dev/null \ - | awk '/^[0-9a-f]{7,} /{h=$$0} /^Upstream: *[Yy]es/{print " " h}' \ - | grep . || echo " (none)" + @echo "Marked 'Upstream: yes' and not yet upstream:" + @git log --format=' %h %s' --grep='^Upstream: *[Yy]es' upstream/main..HEAD | grep . || echo " (none)" @echo - @echo "Unmarked — decide and amend, or ignore:" - @git log --format='%H%x09%h %s' upstream/main..HEAD 2>/dev/null | while IFS=$$'\t' read -r sha line; do \ - git log -1 --format='%B' "$$sha" | grep -qi '^Upstream:' || echo " $$line"; \ - done | grep . || echo " (none)" + @echo "No Upstream: marker — decide, then amend the message:" + @git log --format=' %h %s' --invert-grep --grep='^Upstream:' upstream/main..HEAD | grep . || echo " (none)"