From mboxrd@z Thu Jan 1 00:00:00 1970 From: Junio C Hamano Subject: [PATCH] revert/cherry-pick: allow starting from dirty work tree. Date: Tue, 13 Nov 2007 13:16:28 -0800 Message-ID: <7vd4udsv6b.fsf@gitster.siamese.dyndns.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii To: git@vger.kernel.org X-From: git-owner@vger.kernel.org Tue Nov 13 22:16:57 2007 Return-path: Envelope-to: gcvg-git-2@gmane.org Received: from vger.kernel.org ([209.132.176.167]) by lo.gmane.org with esmtp (Exim 4.50) id 1Is37w-0003a8-OT for gcvg-git-2@gmane.org; Tue, 13 Nov 2007 22:16:57 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757763AbXKMVQd (ORCPT ); Tue, 13 Nov 2007 16:16:33 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755962AbXKMVQd (ORCPT ); Tue, 13 Nov 2007 16:16:33 -0500 Received: from sceptre.pobox.com ([207.106.133.20]:50779 "EHLO sceptre.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757564AbXKMVQc (ORCPT ); Tue, 13 Nov 2007 16:16:32 -0500 Received: from sceptre (localhost.localdomain [127.0.0.1]) by sceptre.pobox.com (Postfix) with ESMTP id BDF602F2; Tue, 13 Nov 2007 16:16:53 -0500 (EST) Received: from pobox.com (ip68-225-240-77.oc.oc.cox.net [68.225.240.77]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by sceptre.sasl.smtp.pobox.com (Postfix) with ESMTP id 5101C95691; Tue, 13 Nov 2007 16:16:52 -0500 (EST) User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) Sender: git-owner@vger.kernel.org Precedence: bulk X-Mailing-List: git@vger.kernel.org Archived-At: 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 --- 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