summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: aac5bf0)
raw | patch | inline | side by side (parent: aac5bf0)
author | Junio C Hamano <gitster@pobox.com> | |
Tue, 13 Nov 2007 20:28:53 +0000 (12:28 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 13 Nov 2007 21:25:51 +0000 (13:25 -0800) |
There is no reason to forbid a dirty work tree when reverting or
cherry-picking a change, as long as the index is clean.
The scripted version used to allow it:
case "$no_commit" in
t)
# We do not intend to commit immediately. We just want to
# merge the differences in.
head=$(git-write-tree) ||
die "Your index file is unmerged."
;;
*)
head=$(git-rev-parse --verify HEAD) ||
die "You do not have a valid HEAD"
files=$(git-diff-index --cached --name-only $head) || exit
if [ "$files" ]; then
die "Dirty index: cannot $me (dirty: $files)"
fi
;;
esac
but C rewrite tightened the check, probably by mistake.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
cherry-picking a change, as long as the index is clean.
The scripted version used to allow it:
case "$no_commit" in
t)
# We do not intend to commit immediately. We just want to
# merge the differences in.
head=$(git-write-tree) ||
die "Your index file is unmerged."
;;
*)
head=$(git-rev-parse --verify HEAD) ||
die "You do not have a valid HEAD"
files=$(git-diff-index --cached --name-only $head) || exit
if [ "$files" ]; then
die "Dirty index: cannot $me (dirty: $files)"
fi
;;
esac
but C rewrite tightened the check, probably by mistake.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-revert.c | patch | blob | history |
diff --git a/builtin-revert.c b/builtin-revert.c
index eafafbc333e784aa2c49ee9d360077cb212797c6..94e77771d24decc60c50adf0cd3ab272ce36d3f2 100644 (file)
--- a/builtin-revert.c
+++ b/builtin-revert.c
if (get_sha1("HEAD", head))
die ("You do not have a valid HEAD");
wt_status_prepare(&s);
- if (s.commitable || s.workdir_dirty)
+ if (s.commitable)
die ("Dirty index: cannot %s", me);
discard_cache();
}