summaryrefslogtreecommitdiff
path: root/git-stash.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-05-19 13:17:52 -0700
committerJunio C Hamano <gitster@pobox.com>2015-05-19 13:17:52 -0700
commit05c39674f35f33b6d2311da6c63268b9e7739840 (patch)
tree8cb45c805c023f64a42d5ae9969865c863385ce1 /git-stash.sh
parent1645dbeff75d466230eb54b8548cfe9c9dcc9e5e (diff)
parented178ef13a26136d86ff4e33bb7b1afb5033f908 (diff)
downloadgit-05c39674f35f33b6d2311da6c63268b9e7739840.tar.gz
Merge branch 'jk/stash-require-clean-index'
"git stash pop/apply" forgot to make sure that not just the working tree is clean but also the index is clean. The latter is important as a stash application can conflict and the index will be used for conflict resolution. * jk/stash-require-clean-index: stash: require a clean index to apply t3903: avoid applying onto dirty index t3903: stop hard-coding commit sha1s
Diffstat (limited to 'git-stash.sh')
-rwxr-xr-xgit-stash.sh2
1 files changed, 2 insertions, 0 deletions
diff --git a/git-stash.sh b/git-stash.sh
index 6846b18dbc..7911f30c63 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -442,6 +442,8 @@ apply_stash () {
assert_stash_like "$@"
git update-index -q --refresh || die "$(gettext "unable to refresh index")"
+ git diff-index --cached --quiet --ignore-submodules HEAD -- ||
+ die "$(gettext "Cannot apply stash: Your index contains uncommitted changes.")"
# current index state
c_tree=$(git write-tree) ||