summaryrefslogtreecommitdiff
path: root/git-stash.sh
diff options
context:
space:
mode:
authorJon Seymour <jon.seymour@gmail.com>2010-09-28 01:32:45 +1000
committerJunio C Hamano <gitster@pobox.com>2010-09-29 13:21:24 -0700
commit2bea593bf0f1159e93dbca1008a18dea4c262e58 (patch)
tree9dc698c4cfd96b3a02f08d593e3b8998d89900aa /git-stash.sh
parent92c1e717779a9aa3267cef232ce80ac93e3460fe (diff)
downloadgit-2bea593bf0f1159e93dbca1008a18dea4c262e58.tar.gz
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>
Diffstat (limited to 'git-stash.sh')
-rwxr-xr-xgit-stash.sh28
1 files changed, 7 insertions, 21 deletions
diff --git a/git-stash.sh b/git-stash.sh
index 02113263e3..5fb1245ea7 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -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