]> git.ipfire.org Git - thirdparty/git.git/commitdiff
git-svn: prevent dcommitting if the index is dirty.
authorBenoit Sigoure <tsuna@lrde.epita.fr>
Sun, 11 Nov 2007 18:41:41 +0000 (19:41 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 12 Nov 2007 07:40:32 +0000 (23:40 -0800)
dcommit uses rebase to sync the history with what has just been pushed to
SVN.  Trying to dcommit with a dirty index is troublesome for rebase, so now
the user will get an error message if he attempts to dcommit with a dirty
index.

Signed-off-by: Benoit Sigoure <tsuna@lrde.epita.fr>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-svn.perl
t/t9106-git-svn-dcommit-clobber-series.sh

index ec25ea4231a062e05753f4f93a757a41062a0364..4c779b6c6d1c53030c0ed984155c885a25604e57 100755 (executable)
@@ -374,6 +374,9 @@ sub cmd_set_tree {
 
 sub cmd_dcommit {
        my $head = shift;
+       git_cmd_try { command_oneline(qw/diff-index --quiet HEAD/) }
+               'Cannot dcommit with a dirty index.  Commit your changes first'
+               . "or stash them with `git stash'.\n";
        $head ||= 'HEAD';
        my @refs;
        my ($url, $rev, $uuid, $gs) = working_head_info($head, \@refs);
index 7eff4cdc05635c85c354c9b2a96fe4844c682621..d59acc8d1ade041d01d5a45aa993b26919a0170c 100755 (executable)
@@ -53,4 +53,10 @@ test_expect_success 'change file but in unrelated area' "
                test x\"\`sed -n -e 61p < file\`\" = x6611
        "
 
+test_expect_failure 'attempt to dcommit with a dirty index' '
+       echo foo >>file &&
+       git add file &&
+       git svn dcommit
+'
+
 test_done