Skip to content

Commit

Permalink
stash: refresh the index before deciding if the work tree is dirty
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Sep 6, 2008
1 parent 1b118da commit 1eff26c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions git-stash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ clear_stash () {
create_stash () {
stash_msg="$1"

git update-index -q --refresh
if no_changes
then
exit 0
Expand Down Expand Up @@ -101,6 +102,7 @@ save_stash () {

stash_msg="$*"

git update-index -q --refresh
if no_changes
then
echo 'No local changes to save'
Expand Down Expand Up @@ -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'

Expand Down

0 comments on commit 1eff26c

Please sign in to comment.