Commit 1eff26c0 authored by Junio C Hamano's avatar Junio C Hamano

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: default avatarJunio C Hamano <[email protected]>
Acked-by: default avatarNanako Shiraishi <[email protected]>
parent 1b118da8
......@@ -39,6 +39,7 @@ clear_stash () {
create_stash () {
git update-index -q --refresh
if no_changes
exit 0
......@@ -101,6 +102,7 @@ save_stash () {
git update-index -q --refresh
if no_changes
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'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment