OSDN Git Service

stash: refresh the index before deciding if the work tree is dirty
authorJunio C Hamano <gitster@pobox.com>
Thu, 4 Sep 2008 09:41:22 +0000 (02:41 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sat, 6 Sep 2008 23:16:42 +0000 (16:16 -0700)
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>
git-stash.sh

index e15c12a..d799c76 100755 (executable)
@@ -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'