Skip to content

Commit

Permalink
stash: simplify parsing fixes
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
jonseymour authored and gitster committed Sep 29, 2010
1 parent 92c1e71 commit 2bea593
Showing 1 changed file with 7 additions and 21 deletions.
28 changes: 7 additions & 21 deletions git-stash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2bea593

Please sign in to comment.