Re: [PATCH v3 3/4] history: add squash subcommand to fold a range
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 18, 2026, 21:24 UTC
- Message-ID
- <xmqqzf0rpmn0.fsf@gitster.g>
- In-Reply-To
- <xmqq7bnvr3qb.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
> As t3454 is taken by another topic already in flight, I've queued a > trivial "rename it to t3455" patch on top before queuing the topic.
Another tweak I had to make was to replace "grep" with "test_grep" to avoid triggering test lint added by another topic in flight.
For the one in the second hunk, it may be much better to rewrite it to process "out" directly with the awk script without preprocessing it with "grep", as awk is a programming language capable enough to recognize a line that matches a pattern and process only those matching lines by itself.
--- >8 --- Author: Junio C Hamano <gitster@pobox.com> Date: Thu Jun 18 13:44:36 2026 -0700
SQUASH??? avoid test_grep lint triggering on uses of raw grep
diff --git a/t/t3455-history-squash.sh b/t/t3455-history-squash.sh index 1edd148295..20370c0136 100755 --- a/t/t3455-history-squash.sh +++ b/t/t3455-history-squash.sh @@ -150,10 +150,10 @@ test_expect_success '--reedit-message offers every folded-in message' ' test_set_editor "$(pwd)/editor" && git history squash --reedit-message start.. && - grep "re-one subject" buffer && - grep "re-one body line" buffer && - grep re-two buffer && - grep re-three buffer && + test_grep "re-one subject" buffer && + test_grep "re-one body line" buffer && + test_grep re-two buffer && + test_grep re-three buffer && git log --format="%s" -1 >actual && echo combined >expect && test_cmp expect actual @@ -177,7 +177,7 @@ test_expect_success '--dry-run predicts the rewrite without performing it' ' head_before=$(git rev-parse HEAD) && git history squash --dry-run start.. >out && - grep "^update refs/heads/" out >update && + test_grep "^update refs/heads/" out >update && predicted=$(awk "{print \$3}" update) && test_cmp_rev "$head_before" HEAD &&