All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] revert/cherry-pick: allow starting from dirty work tree.
@ 2007-11-13 21:16 Junio C Hamano
  2007-11-13 23:37 ` Johannes Schindelin
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2007-11-13 21:16 UTC (permalink / raw)
  To: git

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>
---
 builtin-revert.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/builtin-revert.c b/builtin-revert.c
index cef7147..f704197 100644
--- a/builtin-revert.c
+++ b/builtin-revert.c
@@ -272,7 +272,7 @@ static int revert_or_cherry_pick(int argc, const char **argv)
 		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();
 	}
-- 
1.5.3.5.1728.g34b3e

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-11-14  1:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-13 21:16 [PATCH] revert/cherry-pick: allow starting from dirty work tree Junio C Hamano
2007-11-13 23:37 ` Johannes Schindelin
2007-11-14  0:21   ` Jakub Narebski
2007-11-14  1:05   ` Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.