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 <jaysoffian@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jay Soffian committed
Jan 28, 2009 at 10:03 UTC
98ef23b3b106ef8cf4dc0db34e62a39e044cf99b
1 file changed
+4
-8
git-am.sh
+4
-8
@@ -8,9 +8,8 @@ OPTIONS_SPEC="\
8
git am [options] [<mbox>|<Maildir>...]
9
git am [options] (--resolved | --skip | --abort)
10
--
11
-d,dotest= (removed -- do not use)
11
i,interactive run interactively
13
-b,binary (historical option -- no-op)
12
+b,binary* (historical option -- no-op)
13
3,3way allow fall back on 3way merging if needed
14
s,signoff add a Signed-off-by line to the commit message
15
u,utf8 recode into utf8 (default)
@@ -24,7 +23,7 @@ resolvemsg= override error message when patch failure occurs
23
r,resolved to be used after a patch failure
24
skip skip the current patch
25
abort restore the original branch and abort the patching operation.
27
-rebasing (internal use for git-rebase)"
26
+rebasing* (internal use for git-rebase)"
27
28
. git-sh-setup
29
prefix=$(git rev-parse --show-prefix)
@@ -204,7 +203,7 @@ then
203
# unreliable -- stdin could be /dev/null for example
204
# and the caller did not intend to feed us a patch but
205
# wanted to continue unattended.
207
- tty -s
206
+ test -t 0
207
;;
208
*)
209
false
@@ -280,10 +279,7 @@ fi
279
case "$resolved" in
280
'')
281
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)"
283
esac
284
285
if test "$(cat "$dotest/utf8")" = t