diff options
author | Øystein Walle <oystwa@gmail.com> | 2014-01-07 09:22:15 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-01-07 19:51:04 +0100 |
commit | 2a07e4374c0ba6f2e991965c99b448ccb563f2fc (patch) | |
tree | c05098f54001df66386863fda2062b7a2aceda02 /t/t3903-stash.sh | |
parent | Merge branch 'maint' of git://github.com/git-l10n/git-po into maint (diff) | |
download | git-2a07e4374c0ba6f2e991965c99b448ccb563f2fc.tar.xz git-2a07e4374c0ba6f2e991965c99b448ccb563f2fc.zip |
stash: handle specifying stashes with $IFS
When trying to pop/apply a stash specified with an argument
containing IFS whitespace, git-stash will throw an error:
$ git stash pop 'stash@{two hours ago}'
Too many revisions specified: stash@{two hours ago}
This happens because word splitting is used to count non-option
arguments. Make use of rev-parse's --sq option to quote the arguments
for us to ensure a correct count. Add quotes where necessary.
Also add a test that verifies correct behaviour.
Helped-by: Thomas Rast <tr@thomasrast.ch>
Signed-off-by: Øystein Walle <oystwa@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3903-stash.sh')
-rwxr-xr-x | t/t3903-stash.sh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh index debda7a678..5b79b216e2 100755 --- a/t/t3903-stash.sh +++ b/t/t3903-stash.sh @@ -673,4 +673,16 @@ test_expect_success 'store updates stash ref and reflog' ' grep quux bazzy ' +test_expect_success 'handle stash specification with spaces' ' + git stash clear && + echo pig >file && + git stash && + stamp=$(git log -g --format="%cd" -1 refs/stash) && + test_tick && + echo cow >file && + git stash && + git stash apply "stash@{$stamp}" && + grep pig file +' + test_done |