From: Junio C Hamano Date: Fri, 18 Jun 2010 18:16:56 +0000 (-0700) Subject: Merge branch 'rr/am-help' X-Git-Tag: v1.7.2-rc0~47 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/8b8063cef3933c25288f2ab78d2adf1a4a2149ce?hp=-c Merge branch 'rr/am-help' * rr/am-help: git am: Remove stray error message from sed git am: Display some help text when patch is empty git am: Set cmdline globally --- 8b8063cef3933c25288f2ab78d2adf1a4a2149ce diff --combined git-am.sh index 43ea52c15c,d3f6a89352..ef2d51a2b8 --- a/git-am.sh +++ b/git-am.sh @@@ -52,6 -52,16 +52,16 @@@ els 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 +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 +592,8 @@@ d 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" @@@ -690,7 -693,13 +693,13 @@@ 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 @@@ -726,8 -735,6 +735,8 @@@ 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)