提交 d571c2be 编写于 作者: L Linus Torvalds 提交者: Junio C Hamano

[PATCH] git-applymbox: verify that index is clean

This makes git-applymbox verify that the index matches the current HEAD
before it starts applying patches.

Otherwise, you might have updated the index with unrelated changes, and
the first patch will commit not just the patch from the mbox, but also any
changes you had in your index.
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
Signed-off-by: NJunio C Hamano <junkio@cox.net>
上级 1bff6490
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
## use a Signoff_file, because applypatch wants to append the sign-off ## use a Signoff_file, because applypatch wants to append the sign-off
## message to msg-clean every time it is run. ## message to msg-clean every time it is run.
. git-sh-setup-script || die "Not a git archive"
keep_subject= query_apply= continue= resume=t keep_subject= query_apply= continue= resume=t
while case "$#" in 0) break ;; esac while case "$#" in 0) break ;; esac
do do
...@@ -39,6 +41,12 @@ case "$continue" in ...@@ -39,6 +41,12 @@ case "$continue" in
shift shift
esac esac
files=$(git-diff-cache --cached --name-only HEAD) || exit
if [ "$files" ]; then
echo "Dirty index: cannot apply patches (dirty: $files)" >&2
exit 1
fi
case "$query_apply" in case "$query_apply" in
t) touch .dotest/.query_apply t) touch .dotest/.query_apply
esac esac
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册