@matheusbsbs / matheus-bagliano / commits / 2bea593bf0
Fork 0

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>

Jon Seymour committed Sep 28, 2010 at 01:32 UTC 2bea593bf0f1159e93dbca1008a18dea4c262e58
1 file changed +7 -21
git-stash.sh
+7 -21
@@ -264,36 +264,22 @@ parse_flags_and_rev()
264 b_tree=
265 i_tree=
266
267 - # Work around rev-parse --flags eating -q
268 - for opt
269 - do
270 - case "$opt" in
271 - -q|--quiet)
272 - GIT_QUIET=t
273 - ;;
274 - esac
275 - done
276 -
267 REV=$(git rev-parse --no-flags --symbolic "$@" 2>/dev/null)
278 - FLAGS=$(git rev-parse --no-revs --flags "$@" 2>/dev/null)
279 -
280 - set -- $FLAGS
268
269 FLAGS=
283 - while test $# -ne 0
270 + for opt
271 do
285 - case "$1" in
272 + case "$opt" in
273 + -q|--quiet)
274 + GIT_QUIET=-t
275 + ;;
276 --index)
277 INDEX_OPTION=--index
278 ;;
289 - --)
290 - :
291 - ;;
292 - *)
293 - FLAGS="${FLAGS}${FLAGS:+ }$1"
279 + -*)
280 + FLAGS="${FLAGS}${FLAGS:+ }$opt"
281 ;;
282 esac
296 - shift
283 done
284
285 set -- $REV