git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Rename ".dotest/" to ".git/rebase" and ".dotest-merge" to "rebase-merge"

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 19, 2008, 22:18 UTC
Message-ID
<7v3am5zfea.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<4882350B.6020003@free.fr>
Olivier Marin <dkr+ml.git@free.fr> writes:
Show 5 quoted lines
> Subject: [PATCH] git am --abort
>
> To squash.
>
> Signed-off-by: Olivier Marin <dkr@freesurf.fr>
Thanks.
Show 13 quoted lines
> @@ -203,9 +204,10 @@ then
>  
>  	case "$abort" in
>  	t)
> -		rm -fr "$dotest" &&
> +		git rerere clear &&
>  		git read-tree -m -u ORIG_HEAD &&
> -		git reset ORIG_HEAD && :
> +		git reset ORIG_HEAD &&
> +		rm -fr "$dotest"
>  		exit ;;
>  	esac
>  else

Clearing the rerere information needs to be done, but I think we should drop the last && to make sure we remove "$dotest" and exit with its exit status.

I'm happy with the documentation and help-text parts of your patch, but probably this, on top of 1a6f6bb (git am --abort, 2008-07-16), is more appropriate?

--- 
 git-am.sh           |    6 +++---
 t/t4151-am-abort.sh |   46 +++++++++++++++++++++++++++-------------------
 2 files changed, 30 insertions(+), 22 deletions(-)
diff --git a/git-am.sh b/git-am.sh
index a44bd7a..5cbf8f4 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -203,9 +203,9 @@ then
 
 	case "$abort" in
 	t)
-		rm -fr "$dotest" &&
-		git read-tree -m -u ORIG_HEAD &&
-		git reset ORIG_HEAD && :
+		git rerere clear
+		git read-tree --reset -u HEAD ORIG_HEAD
+		rm -fr "$dotest"
 		exit ;;
 	esac
 else
diff --git a/t/t4151-am-abort.sh b/t/t4151-am-abort.sh
index 96b2cd5..dda7e2c 100755
--- a/t/t4151-am-abort.sh
+++ b/t/t4151-am-abort.sh
@@ -22,27 +22,35 @@ test_expect_success setup '
 	done &&
 	git format-patch initial &&
 	git checkout -b side initial &&
-	echo local change >file-2 &&
-	cp file-2 file-2-expect
+	echo local change >file-2-expect
 '
 
-test_expect_success 'am stops at a patch that does not apply' '
-	test_must_fail git am 000[124]-*.patch &&
-	git log --pretty=tformat:%s >actual &&
-	for i in 3 2 initial
-	do
-		echo $i
-	done >expect &&
-	test_cmp expect actual
-'
+for with3 in '' ' -3'
+do
+	test_expect_success "am$with3 stops at a patch that does not apply" '
 
-test_expect_success 'am --abort goes back' '
-	git am --abort &&
-	git rev-parse HEAD >actual &&
-	git rev-parse initial >expect &&
-	test_cmp expect actual &&
-	test_cmp file-2-expect file-2 &&
-	git diff-index --exit-code --cached HEAD
-'
+		git reset --hard initial &&
+		cp file-2-expect file-2 &&
+
+		test_must_fail git am$with3 000[124]-*.patch &&
+		git log --pretty=tformat:%s >actual &&
+		for i in 3 2 initial
+		do
+			echo $i
+		done >expect &&
+		test_cmp expect actual
+	'
+
+	test_expect_success "am --abort goes back after failed am$with3" '
+		git-am --abort &&
+		git rev-parse HEAD >actual &&
+		git rev-parse initial >expect &&
+		test_cmp expect actual &&
+		test_cmp file-2-expect file-2 &&
+		git diff-index --exit-code --cached HEAD &&
+		test ! -f .git/rr-cache/MERGE_RR
+	'
+
+done
 
 test_done
Previous: Olivier MarinNext: Junio C Hamano
Message 19 of 37 in “Git rebase failure: .dotest overwritten”
  1. Joe FioriniJul 15, 2008
  2. Stephan BeyerJul 15, 2008
  3. René ScharfeJul 15, 2008
  4. Rename ".dotest/" to ".git/rebase" and ".dotest-merge" to "rebase-merge"Johannes Schindelin, Jul 16, 2008
  5. Linus TorvaldsJul 16, 2008
  6. Junio C HamanoJul 16, 2008
  7. Johannes SchindelinJul 16, 2008
  8. Junio C HamanoJul 16, 2008
  9. Rename ".dotest/" to ".git/rebase" and ".dotest-merge" to "rebase-merge"Johannes Schindelin, Jul 16, 2008
  10. Linus TorvaldsJul 16, 2008
  11. Johannes SchindelinJul 16, 2008
  12. Junio C HamanoJul 16, 2008
  13. Petr BaudisJul 16, 2008
  14. Junio C HamanoJul 16, 2008
  15. Theodore TsoJul 16, 2008
  16. Stephan BeyerJul 16, 2008
  17. Junio C HamanoJul 16, 2008
  18. Olivier MarinJul 19, 2008
  19. Junio C HamanoJul 19, 2008
  20. Junio C HamanoJul 19, 2008
  21. Stephan BeyerJul 22, 2008
  22. Junio C HamanoJul 23, 2008
  23. Stephan BeyerJul 23, 2008
  24. Olivier MarinJul 23, 2008
  25. Stephan BeyerJul 23, 2008
  26. Junio C HamanoJul 23, 2008
  27. am --abort: Add to bash-completion and mention in git-rerere documentationStephan Beyer, Jul 23, 2008
  28. Olivier MarinJul 19, 2008
  29. Stephan BeyerJul 19, 2008
  30. Olivier MarinJul 19, 2008
  31. Junio C HamanoJul 19, 2008
  32. Jakub NarebskiJul 19, 2008
  33. Olivier MarinJul 21, 2008
  34. Junio C HamanoJul 23, 2008
  35. Olivier MarinJul 23, 2008
  36. Junio C HamanoJul 23, 2008
  37. Olivier MarinJul 24, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.