Thread (185 messages) flat view 185 messages, 9 authors, 1d ago

Re: [PATCH v13 7/8] history: create squashed commits without editing

From: Junio C Hamano <hidden>
Date: 2026-08-13 21:52:57
Subsystem: the rest · Maintainer: Linus Torvalds

Junio C Hamano [off-list ref] writes:
"Harald Nordgren via GitGitGadget" [off-list ref] writes:
quoted
+test_expect_success '--no-edit uses last "amend!" message without an editor' '
+	git reset --hard three &&
+	write_script editor <<-\EOF &&
+	exit 1
+	EOF
+	test_set_editor "$(pwd)/editor" &&
+	echo fix >file &&
+	git commit --author="Fix Me [off-list ref]" --fixup=HEAD -a &&
+	git commit --allow-empty -F - <<-EOF &&
+	amend! $(git rev-parse --short HEAD)
+
+	The first reword
+
+	More detail
+	EOF
+
+	git commit --allow-empty -F - <<-\EOF &&
+	amend! three
+
+	The second reword
+
+	Extra detail
+	EOF
+
+	test_commit WIP &&
+
+	cat >msg <<-EOF &&
+	amend! $(git rev-parse HEAD^ | tr a-f A-F)
+
+	The third reword
+
+	Excruciating detail
+	EOF
Care to explain why you need to (1) eat the exit status of the 'git
rev-parse' command and (2) munge the commit object name by piping it
into "tr"?

When another in-flight topic is in effect, this test will break due
to "amend!" followed by a string that is *not* an object name, as
the other topic declares that uppercase letters are not valid in a
hexadecimal string.
In the meantime, I've queued the following on top of the series
before rebuilding 'seen'.

diff --git a/t/t3455-history-squash.sh b/t/t3455-history-squash.sh
index 591463cb86..d21e9d9fc4 100755
--- a/t/t3455-history-squash.sh
+++ b/t/t3455-history-squash.sh
@@ -309,7 +309,7 @@ test_expect_success '--no-edit uses last "amend!" message without an editor' '
 	test_commit WIP &&
 
 	cat >msg <<-EOF &&
-	amend! $(git rev-parse HEAD^ | tr a-f A-F)
+	amend! $(git rev-parse --short HEAD^)
 
 	The third reword
 
-- 
2.55.0-758-g31b934252d
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help