Skip to content

Commit 245de36

Browse files
committed
revert/cherry-pick: allow starting from dirty work tree.
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>
1 parent aac5bf0 commit 245de36

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

builtin-revert.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ static int revert_or_cherry_pick(int argc, const char **argv)
264264
if (get_sha1("HEAD", head))
265265
die ("You do not have a valid HEAD");
266266
wt_status_prepare(&s);
267-
if (s.commitable || s.workdir_dirty)
267+
if (s.commitable)
268268
die ("Dirty index: cannot %s", me);
269269
discard_cache();
270270
}

0 commit comments

Comments
 (0)