From 95f8ebbfc7997b3114d4f09360501324905c4e6d Mon Sep 17 00:00:00 2001 From: Olivier Marin Date: Mon, 21 Jul 2008 15:39:06 +0200 Subject: git am --skip: clean the index while preserving local changes In 3-way merge, "am" will let the index with unmerged path waiting for us to resolve conflicts and continue. But if we want to --skip instead, "am" refuses to continue because of the dirty index. With this patch, "am" will clean the index without touching files locally modified, before continuing. Signed-off-by: Olivier Marin Signed-off-by: Junio C Hamano --- git-am.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'git-am.sh') diff --git a/git-am.sh b/git-am.sh index fcbffb2ba1..7864b5f588 100755 --- a/git-am.sh +++ b/git-am.sh @@ -202,8 +202,15 @@ then die "previous rebase directory $dotest still exists but mbox given." resume=yes - case "$abort" in - t) + case "$skip,$abort" in + t,) + git rerere clear + git read-tree --reset -u HEAD HEAD + orig_head=$(cat "$GIT_DIR/ORIG_HEAD") + git reset HEAD + git update-ref ORIG_HEAD $orig_head + ;; + ,t) git rerere clear git read-tree --reset -u HEAD ORIG_HEAD git reset ORIG_HEAD @@ -297,7 +304,6 @@ last=`cat "$dotest/last"` this=`cat "$dotest/next"` if test "$skip" = t then - git rerere clear this=`expr "$this" + 1` resume= fi -- cgit v1.2.3