Skip to content

Commit 98ef23b

Browse files
jaysoffiangitster
authored andcommitted
git-am: minor cleanups
Update usage statement to remove a no-longer supported option, and to hide two options (one a no-op, one internal) unless --help-all is used. Use "test -t 0" instead of "tty -s" to detect when stdin is a terminal. (test -t 0 is used elsewhere in git-am and in other git shell scripts, tty -s is not, and appears to be deprecated by POSIX) Use "test ..." instead of "[ ... ]" and "die <msg>" instead of "echo <msg> >&2; exit 1" to be consistent with rest of script. Signed-off-by: Jay Soffian <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d040993 commit 98ef23b

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

git-am.sh

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ OPTIONS_SPEC="\
88
git am [options] [<mbox>|<Maildir>...]
99
git am [options] (--resolved | --skip | --abort)
1010
--
11-
d,dotest= (removed -- do not use)
1211
i,interactive run interactively
13-
b,binary (historical option -- no-op)
12+
b,binary* (historical option -- no-op)
1413
3,3way allow fall back on 3way merging if needed
1514
s,signoff add a Signed-off-by line to the commit message
1615
u,utf8 recode into utf8 (default)
@@ -24,7 +23,7 @@ resolvemsg= override error message when patch failure occurs
2423
r,resolved to be used after a patch failure
2524
skip skip the current patch
2625
abort restore the original branch and abort the patching operation.
27-
rebasing (internal use for git-rebase)"
26+
rebasing* (internal use for git-rebase)"
2827

2928
. git-sh-setup
3029
prefix=$(git rev-parse --show-prefix)
@@ -204,7 +203,7 @@ then
204203
# unreliable -- stdin could be /dev/null for example
205204
# and the caller did not intend to feed us a patch but
206205
# wanted to continue unattended.
207-
tty -s
206+
test -t 0
208207
;;
209208
*)
210209
false
@@ -280,10 +279,7 @@ fi
280279
case "$resolved" in
281280
'')
282281
files=$(git diff-index --cached --name-only HEAD --) || exit
283-
if [ "$files" ]; then
284-
echo "Dirty index: cannot apply patches (dirty: $files)" >&2
285-
exit 1
286-
fi
282+
test "$files" && die "Dirty index: cannot apply patches (dirty: $files)"
287283
esac
288284

289285
if test "$(cat "$dotest/utf8")" = t

0 commit comments

Comments
 (0)