]> git.ipfire.org Git - thirdparty/git.git/commit - t/t3903-stash.sh
stash: Don't fail if work dir contains file named 'HEAD'
authorJonathon Mah <me@JonathonMah.com>
Sat, 31 Dec 2011 00:14:01 +0000 (16:14 -0800)
committerJunio C Hamano <gitster@pobox.com>
Sun, 1 Jan 2012 09:11:56 +0000 (01:11 -0800)
commit44df2e297025d7a9af6c265dfefb687b09e2537a
tree3249d6f12743491be81d70a9253986f6529dce7e
parent17b4e93d5b849293e6a3659bbc4075ed8a6e97e2
stash: Don't fail if work dir contains file named 'HEAD'

When performing a plain "git stash" (without --patch), git-diff would fail
with "fatal: ambiguous argument 'HEAD': both revision and filename". The
output was piped into git-update-index, masking the failed exit status.
The output is now sent to a temporary file (which is cleaned up by
existing code), and the exit status is checked. The "HEAD" arg to the
git-diff invocation has been disambiguated too, of course.

In patch mode, "git stash -p" would fail harmlessly, leaving the working
dir untouched. Interactive adding is fine, but the resulting tree was
diffed with an ambiguous 'HEAD' argument.

Use >foo (no space) when redirecting output.

In t3904, checks and operations on each file are in the order they'll
appear when interactively staging.

In t3905, fix a bug in "stash save --include-untracked -q is quiet": The
redirected stdout file was considered untracked, and so was removed from
the working directory. Use test path helper functions where appropriate.

Signed-off-by: Jonathon Mah <me@JonathonMah.com>
Acked-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-stash.sh
t/t3903-stash.sh
t/t3904-stash-patch.sh
t/t3905-stash-include-untracked.sh