X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-am.sh;h=87ffae252b3f2ff88646d142ea9c2dfb38a28953;hb=3b65270dcc1fe2d16f055d1a36a29616b9f89141;hp=50a292a7da58aab3b5ce62347b02dee35395da2a;hpb=60dafdd37d7df358b6ff67b317dbe738b50ea6d6;p=git.git diff --git a/git-am.sh b/git-am.sh index 50a292a7d..87ffae252 100755 --- a/git-am.sh +++ b/git-am.sh @@ -593,6 +593,7 @@ do echo "Patch is empty. Was it split wrong?" stop_here $this } + rm -f "$dotest/original-commit" if test -f "$dotest/rebasing" && commit=$(sed -e 's/^From \([0-9a-f]*\) .*/\1/' \ -e q "$dotest/$msgnum") && @@ -600,6 +601,7 @@ do then git cat-file commit "$commit" | sed -e '1,/^$/d' >"$dotest/msg-clean" + echo "$commit" > "$dotest/original-commit" else { sed -n '/^Subject/ s/Subject: //p' "$dotest/info" @@ -738,7 +740,7 @@ do ;; esac - if test $apply_status = 1 && test "$threeway" = t + if test $apply_status != 0 && test "$threeway" = t then if (fall_back_3way) then @@ -783,6 +785,10 @@ do git update-ref -m "$GIT_REFLOG_ACTION: $FIRSTLINE" HEAD $commit $parent || stop_here $this + if test -f "$dotest/original-commit"; then + echo "$(cat "$dotest/original-commit") $commit" >> "$dotest/rewritten" + fi + if test -x "$GIT_DIR"/hooks/post-applypatch then "$GIT_DIR"/hooks/post-applypatch @@ -791,5 +797,12 @@ do go_next done +if test -s "$dotest"/rewritten; then + git notes copy --for-rewrite=rebase < "$dotest"/rewritten + if test -x "$GIT_DIR"/hooks/post-rewrite; then + "$GIT_DIR"/hooks/post-rewrite rebase < "$dotest"/rewritten + fi +fi + rm -fr "$dotest" git gc --auto