mirror of
https://github.com/git/git
synced 2024-08-25 02:35:46 +00:00
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: Jon Seymour <jon.seymour@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
92c1e71777
commit
2bea593bf0
28
git-stash.sh
28
git-stash.sh
|
@ -264,36 +264,22 @@ parse_flags_and_rev()
|
|||
b_tree=
|
||||
i_tree=
|
||||
|
||||
# Work around rev-parse --flags eating -q
|
||||
REV=$(git rev-parse --no-flags --symbolic "$@" 2>/dev/null)
|
||||
|
||||
FLAGS=
|
||||
for opt
|
||||
do
|
||||
case "$opt" in
|
||||
-q|--quiet)
|
||||
GIT_QUIET=t
|
||||
-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
|
||||
do
|
||||
case "$1" in
|
||||
--index)
|
||||
INDEX_OPTION=--index
|
||||
;;
|
||||
--)
|
||||
:
|
||||
;;
|
||||
*)
|
||||
FLAGS="${FLAGS}${FLAGS:+ }$1"
|
||||
-*)
|
||||
FLAGS="${FLAGS}${FLAGS:+ }$opt"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
set -- $REV
|
||||
|
|
Loading…
Reference in a new issue