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>
Junio C Hamano committed
Sep 4, 2008 at 02:41 UTC
1eff26c0e25652ec60e1f9f1c35fc02c8ad22d98
1 file changed
+3
git-stash.sh
+3
@@ -39,6 +39,7 @@ clear_stash () {
39
create_stash () {
40
stash_msg="$1"
41
42
+ git update-index -q --refresh
43
if no_changes
44
then
45
exit 0
@@ -101,6 +102,7 @@ save_stash () {
102
103
stash_msg="$*"
104
105
+ git update-index -q --refresh
106
if no_changes
107
then
108
echo 'No local changes to save'
@@ -150,6 +152,7 @@ show_stash () {
152
}
153
154
apply_stash () {
155
+ git update-index -q --refresh &&
156
git diff-files --quiet --ignore-submodules ||
157
die 'Cannot restore on top of a dirty state'
158