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

From: Olivier Marin <[email-masked]>
Date: Sat, 19 Jul 2008 20:40:11 +0200

Junio C Hamano a écrit :
> Theodore Tso <[email-masked]> writes:
> 
>> While you have "git am" open, how about adding an "git am --abort"
>> which nukes the .dotest aka .git/rebase directory, and resets HEAD
>> back to the original position?
> 
> This does not seem to have reached the list nor its archives.  I cannot
> say I have really looked at it deeply but it may be a good starting
> point.  It needs docs ;-)

This can be squashed to Nanako's path: it adds missing docs,
'git rerere clear' and move $dotest deletion at the end in case
'git read-tree' failed (because of a dirty index).

Olivier.

-- >8 --
Subject: [PATCH] git am --abort

To squash.

Signed-off-by: Olivier Marin <[email-masked]>
---
 Documentation/git-am.txt |    5 ++++-
 git-am.sh                |    8 +++++---
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt
index 2d7f162..e010a16 100644
--- a/Documentation/git-am.txt
+++ b/Documentation/git-am.txt
@@ -13,7 +13,7 @@ SYNOPSIS
          [--3way] [--interactive] [--binary]
          [--whitespace=<option>] [-C<n>] [-p<n>]
 	 [<mbox> | <Maildir>...]
-'git am' (--skip | --resolved)
+'git am' (--skip | --resolved | --abort)
 
 DESCRIPTION
 -----------
@@ -99,6 +99,9 @@ default.   You could use `--no-utf8` to override this.
 	or `--skip` to handle the failure.  This is solely
 	for internal use between 'git-rebase' and 'git-am'.
 
+--abort::
+	Restore the original branch and abort the patching operation.
+
 DISCUSSION
 ----------
 
diff --git a/git-am.sh b/git-am.sh
index 5e645e4..04b2e96 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -22,7 +22,7 @@ p=              pass it through git-apply
 resolvemsg=     override error message when patch failure occurs
 r,resolved      to be used after a patch failure
 skip            skip the current patch
-abort           abandon patch application and clear .dotest directory
+abort           restore the original branch and abort the patching operation.
 rebasing        (internal use for git-rebase)"
 
 . git-sh-setup
@@ -55,6 +55,7 @@ stop_here_user_resolve () {
     fi
     echo "When you have resolved this problem run \"$cmdline --resolved\"."
     echo "If you would prefer to skip this patch, instead run \"$cmdline --skip\"."
+    echo "To restore the original branch and stop patching run \"$cmdline --abort\"."
 
     stop_here $1
 }
@@ -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
-- 
1.5.6.3.441.g3087