summaryrefslogtreecommitdiff
path: root/git-am.sh
diff options
context:
space:
mode:
Diffstat (limited to 'git-am.sh')
-rwxr-xr-xgit-am.sh6
1 files changed, 5 insertions, 1 deletions
diff --git a/git-am.sh b/git-am.sh
index e0d067c00e..f71d7bb997 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -509,7 +509,11 @@ then
git rerere clear
if safe_to_abort
then
- git read-tree --reset -u HEAD ORIG_HEAD
+ head_tree=$(git rev-parse --verify -q HEAD || echo $empty_tree) &&
+ git read-tree --reset -u $head_tree $head_tree &&
+ index_tree=$(git write-tree) &&
+ orig_head=$(git rev-parse --verify -q ORIG_HEAD || echo $empty_tree) &&
+ git read-tree -m -u $index_tree $orig_head
git reset ORIG_HEAD
fi
rm -fr "$dotest"