summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8324b97)
raw | patch | inline | side by side (parent: 8324b97)
author | Thomas Rast <trast@student.ethz.ch> | |
Mon, 15 Feb 2010 16:05:46 +0000 (17:05 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 16 Feb 2010 05:46:27 +0000 (21:46 -0800) |
The 'git stash pop' option parsing used to remove the first argument
in --index mode. At the time this was implemented, this first
argument was always --index. However, since the invention of the -q
option in fcdd0e9 (stash: teach quiet option, 2009-06-17) you can
cause an internal invocation of
git stash drop --index
by running
git stash pop -q --index
which then of course fails because drop doesn't know --index.
To handle this, instead let 'git stash apply' decide what the future
argument to 'drop' should be.
Warning: this means that 'git stash apply' must parse all options that
'drop' can take, and deal with them in the same way. This is
currently true for its only option -q.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Acked-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
in --index mode. At the time this was implemented, this first
argument was always --index. However, since the invention of the -q
option in fcdd0e9 (stash: teach quiet option, 2009-06-17) you can
cause an internal invocation of
git stash drop --index
by running
git stash pop -q --index
which then of course fails because drop doesn't know --index.
To handle this, instead let 'git stash apply' decide what the future
argument to 'drop' should be.
Warning: this means that 'git stash apply' must parse all options that
'drop' can take, and deal with them in the same way. This is
currently true for its only option -q.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Acked-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-stash.sh | patch | blob | history | |
t/t3903-stash.sh | patch | blob | history |
diff --git a/git-stash.sh b/git-stash.sh
index 4febbbfa5d13b241e9bfcc479c6767a90bd12919..79b277109975cbda46f91de3bdcabbf98e084d53 100755 (executable)
--- a/git-stash.sh
+++ b/git-stash.sh
}
apply_stash () {
+ applied_stash=
unstash_index=
while test $# != 0
if test $# = 0
then
have_stash || die 'Nothing to apply'
+ applied_stash="$ref_stash@{0}"
+ else
+ applied_stash="$*"
fi
# stash records the work tree, and is a merge between the
shift
if apply_stash "$@"
then
- test -z "$unstash_index" || shift
- drop_stash "$@"
+ drop_stash "$applied_stash"
fi
;;
branch)
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index 5514f74b30aa74fe2bf214e90f9ad8f4da2876e4..476e5ec038f3c9fd2cad4607c3819f54dabd04ad 100755 (executable)
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
test ! -s output.out
'
+test_expect_success 'pop -q --index works and is quiet' '
+ echo foo > file &&
+ git add file &&
+ git stash save --quiet &&
+ git stash pop -q --index > output.out 2>&1 &&
+ test foo = "$(git show :file)" &&
+ test ! -s output.out
+'
+
test_expect_success 'drop -q is quiet' '
git stash &&
git stash drop -q > output.out 2>&1 &&