X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-am.sh;h=e7f008c7baae2ff484e16882e199b6b9d75195aa;hb=9b93aeb29cea16880926bc150ac31cfb31475a44;hp=1df5b04146a118831f4b8d30652aa506c7e4b02e;hpb=54fcb21b899eefc299c4ad94d2f2e229c72d3be5;p=git.git diff --git a/git-am.sh b/git-am.sh index 1df5b0414..e7f008c7b 100755 --- a/git-am.sh +++ b/git-am.sh @@ -52,6 +52,16 @@ else HAS_HEAD= fi +cmdline="git am" +if test '' != "$interactive" +then + cmdline="$cmdline -i" +fi +if test '' != "$threeway" +then + cmdline="$cmdline -3" +fi + sq () { git rev-parse --sq-quote "$@" } @@ -66,15 +76,6 @@ stop_here_user_resolve () { printf '%s\n' "$resolvemsg" stop_here $1 fi - cmdline="git am" - if test '' != "$interactive" - then - cmdline="$cmdline -i" - fi - if test '' != "$threeway" - then - cmdline="$cmdline -3" - 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\"." @@ -591,6 +592,8 @@ do test -s "$dotest/patch" || { echo "Patch is empty. Was it split wrong?" + 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 $this } rm -f "$dotest/original-commit" "$dotest/author-script" @@ -696,7 +699,13 @@ do else action=yes fi - FIRSTLINE=$(sed 1q "$dotest/final-commit") + + if test -f "$dotest/final-commit" + then + FIRSTLINE=$(sed 1q "$dotest/final-commit") + else + FIRSTLINE="" + fi if test $action = skip then @@ -732,6 +741,8 @@ do resolved= git diff-index --quiet --cached HEAD -- && { echo "No changes - did you forget to use 'git add'?" + echo "If there is nothing left to stage, chances are that something else" + echo "already introduced the same changes; you might want to skip this patch." stop_here_user_resolve $this } unmerged=$(git ls-files -u)