提交 2bea593b 编写于 作者: J Jon Seymour 提交者: Junio C Hamano

stash: simplify parsing fixes

This patch simplifies Brian's fix for the recent regression by:

* eliminating the extra loop
* eliminating use of git rev-parse for parsing flags
* making use of the for opt idiom for the retained loop
* eliminating the redundant -- case

The patch has been tested with the tests in current maint.
Signed-off-by: NJon Seymour <jon.seymour@gmail.com>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 92c1e717
......@@ -264,36 +264,22 @@ parse_flags_and_rev()
b_tree=
i_tree=
# Work around rev-parse --flags eating -q
for opt
do
case "$opt" in
-q|--quiet)
GIT_QUIET=t
;;
esac
done
REV=$(git rev-parse --no-flags --symbolic "$@" 2>/dev/null)
FLAGS=$(git rev-parse --no-revs --flags "$@" 2>/dev/null)
set -- $FLAGS
FLAGS=
while test $# -ne 0
for opt
do
case "$1" in
case "$opt" in
-q|--quiet)
GIT_QUIET=-t
;;
--index)
INDEX_OPTION=--index
;;
--)
:
;;
*)
FLAGS="${FLAGS}${FLAGS:+ }$1"
-*)
FLAGS="${FLAGS}${FLAGS:+ }$opt"
;;
esac
shift
done
set -- $REV
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册