Skip to content

Commit 8b8063c

Browse files
committed
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
2 parents 0f0169d + 92f65e6 commit 8b8063c

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

git-am.sh

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ else
5252
HAS_HEAD=
5353
fi
5454

55+
cmdline="git am"
56+
if test '' != "$interactive"
57+
then
58+
cmdline="$cmdline -i"
59+
fi
60+
if test '' != "$threeway"
61+
then
62+
cmdline="$cmdline -3"
63+
fi
64+
5565
sq () {
5666
git rev-parse --sq-quote "$@"
5767
}
@@ -66,15 +76,6 @@ stop_here_user_resolve () {
6676
printf '%s\n' "$resolvemsg"
6777
stop_here $1
6878
fi
69-
cmdline="git am"
70-
if test '' != "$interactive"
71-
then
72-
cmdline="$cmdline -i"
73-
fi
74-
if test '' != "$threeway"
75-
then
76-
cmdline="$cmdline -3"
77-
fi
7879
echo "When you have resolved this problem run \"$cmdline --resolved\"."
7980
echo "If you would prefer to skip this patch, instead run \"$cmdline --skip\"."
8081
echo "To restore the original branch and stop patching run \"$cmdline --abort\"."
@@ -591,6 +592,8 @@ do
591592

592593
test -s "$dotest/patch" || {
593594
echo "Patch is empty. Was it split wrong?"
595+
echo "If you would prefer to skip this patch, instead run \"$cmdline --skip\"."
596+
echo "To restore the original branch and stop patching run \"$cmdline --abort\"."
594597
stop_here $this
595598
}
596599
rm -f "$dotest/original-commit"
@@ -690,7 +693,13 @@ do
690693
else
691694
action=yes
692695
fi
693-
FIRSTLINE=$(sed 1q "$dotest/final-commit")
696+
697+
if test -f "$dotest/final-commit"
698+
then
699+
FIRSTLINE=$(sed 1q "$dotest/final-commit")
700+
else
701+
FIRSTLINE=""
702+
fi
694703

695704
if test $action = skip
696705
then

0 commit comments

Comments
 (0)