Thread (2 messages) flat view 2 messages, 2 authors, 2021-09-08

Re: [PATCH 1/2] t4151: document a pair of am --abort bugs

From: Junio C Hamano <hidden>
Date: 2021-09-08 07:02:30

"Elijah Newren via GitGitGadget" [off-list ref] writes:
+test_expect_failure 'git am --abort returns us to a clean state' '
+	git checkout changes &&
+	git format-patch -1 --stdout conflicting >changes.mbox &&
+	test_must_fail git am --3way changes.mbox &&
+
+	# Make a change related to the rest of the am work
+	echo related change >>file-2 &&
+
+	# Abort, and expect the related change to go away too
+	git am --abort &&
+	git status --porcelain -uno >actual &&
+	test_must_be_empty actual
This test makes me worried.  It is perfectly normal for "am" to be
asked to work in a dirty working tree as long as the index is clean
and the working tree files that are involved in the patch are
unmodified.  Even though you may want "am --abort" to restore the
paths that the operation touched to their original state, I am not
sure if that is always possible, given that there may have been
dirty working tree files to begin with.

And the above test would succeed if "git am --abort" internally
called "git reset --hard", which definitely is not what we want to
see.  We want the local changes in dirty working tree files that
weren't involved in the patch application to stay, even after
running "am --abort".
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help