From d2c46310618ab0fefe4641b5a0d71899c918bf47 Mon Sep 17 00:00:00 2001 From: Ramkumar Ramachandra Date: Wed, 2 Jun 2010 10:33:35 +0200 Subject: git am: Set cmdline globally Set the $cmdline variable globally, and not in stop_here_user_resolve so it can be used in other code fragments as well. Signed-off-by: Ramkumar Ramachandra Signed-off-by: Junio C Hamano --- git-am.sh | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'git-am.sh') diff --git a/git-am.sh b/git-am.sh index 87ffae252..83a0df035 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\"." -- cgit v1.2.1 From dc267b1ab4f8f6ac33c9145c3e24fe3a96f1394b Mon Sep 17 00:00:00 2001 From: Ramkumar Ramachandra Date: Wed, 2 Jun 2010 10:33:36 +0200 Subject: git am: Display some help text when patch is empty When a patch is found to be empty, prompt the user to use either --skip or --abort. Signed-off-by: Ramkumar Ramachandra Signed-off-by: Junio C Hamano --- git-am.sh | 2 ++ 1 file changed, 2 insertions(+) (limited to 'git-am.sh') diff --git a/git-am.sh b/git-am.sh index 83a0df035..b6068df6b 100755 --- a/git-am.sh +++ b/git-am.sh @@ -592,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" -- cgit v1.2.1 From 92f65e6ab6185aae241d1388b54429d171a9d0f5 Mon Sep 17 00:00:00 2001 From: Ramkumar Ramachandra Date: Wed, 2 Jun 2010 10:33:37 +0200 Subject: git am: Remove stray error message from sed When --continue is invoked without any changes, the following stray error message appears- sed: can't read $dotest/final-commit: No such file or directory. Remove this by making sure that the file actually exists. Signed-off-by: Ramkumar Ramachandra Signed-off-by: Junio C Hamano --- git-am.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'git-am.sh') diff --git a/git-am.sh b/git-am.sh index b6068df6b..d3f6a8935 100755 --- a/git-am.sh +++ b/git-am.sh @@ -693,7 +693,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 -- cgit v1.2.1