aboutsummaryrefslogtreecommitdiff
path: root/git-stash.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-09-04 02:41:22 -0700
committerJunio C Hamano <gitster@pobox.com>2008-09-06 16:16:42 -0700
commit1eff26c0e25652ec60e1f9f1c35fc02c8ad22d98 (patch)
tree8bcc39ac32b177b1c99622f8514f6f2662ce0962 /git-stash.sh
parent1b118da8bd1878d78589afd9f755b9d52a9579ad (diff)
downloadgit-1eff26c0e25652ec60e1f9f1c35fc02c8ad22d98.tar.gz
git-1eff26c0e25652ec60e1f9f1c35fc02c8ad22d98.tar.xz
stash: refresh the index before deciding if the work tree is dirty
Unlike the case where the user does have a real change in the work tree, refusing to work because of unclean stat information is not very helpful. Signed-off-by: Junio C Hamano <gitster@pobox.com> Acked-by: Nanako Shiraishi <nanako3@lavabit.com>
Diffstat (limited to 'git-stash.sh')
-rwxr-xr-xgit-stash.sh3
1 files changed, 3 insertions, 0 deletions
diff --git a/git-stash.sh b/git-stash.sh
index e15c12abc..d799c7637 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -39,6 +39,7 @@ clear_stash () {
create_stash () {
stash_msg="$1"
+ git update-index -q --refresh
if no_changes
then
exit 0
@@ -101,6 +102,7 @@ save_stash () {
stash_msg="$*"
+ git update-index -q --refresh
if no_changes
then
echo 'No local changes to save'
@@ -150,6 +152,7 @@ show_stash () {
}
apply_stash () {
+ git update-index -q --refresh &&
git diff-files --quiet --ignore-submodules ||
die 'Cannot restore on top of a dirty state'