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>maint
parent
1b118da8bd
commit
1eff26c0e2
|
@ -39,6 +39,7 @@ clear_stash () {
|
||||||
create_stash () {
|
create_stash () {
|
||||||
stash_msg="$1"
|
stash_msg="$1"
|
||||||
|
|
||||||
|
git update-index -q --refresh
|
||||||
if no_changes
|
if no_changes
|
||||||
then
|
then
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -101,6 +102,7 @@ save_stash () {
|
||||||
|
|
||||||
stash_msg="$*"
|
stash_msg="$*"
|
||||||
|
|
||||||
|
git update-index -q --refresh
|
||||||
if no_changes
|
if no_changes
|
||||||
then
|
then
|
||||||
echo 'No local changes to save'
|
echo 'No local changes to save'
|
||||||
|
@ -150,6 +152,7 @@ show_stash () {
|
||||||
}
|
}
|
||||||
|
|
||||||
apply_stash () {
|
apply_stash () {
|
||||||
|
git update-index -q --refresh &&
|
||||||
git diff-files --quiet --ignore-submodules ||
|
git diff-files --quiet --ignore-submodules ||
|
||||||
die 'Cannot restore on top of a dirty state'
|
die 'Cannot restore on top of a dirty state'
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue