@matheusbsbs / matheus-bagliano / commits / c8cfa3e4a5
Fork 0

git-svn: prevent dcommitting if the index is dirty.

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>

Benoit Sigoure committed Nov 11, 2007 at 19:41 UTC c8cfa3e4a5b1d1d4c870c82d2dbf162f570f0561
2 files changed +9
git-svn.perl
+3
@@ -374,6 +374,9 @@ sub cmd_set_tree {
374
375 sub cmd_dcommit {
376 my $head = shift;
377 + git_cmd_try { command_oneline(qw/diff-index --quiet HEAD/) }
378 + 'Cannot dcommit with a dirty index. Commit your changes first'
379 + . "or stash them with `git stash'.\n";
380 $head ||= 'HEAD';
381 my @refs;
382 my ($url, $rev, $uuid, $gs) = working_head_info($head, \@refs);
t/t9106-git-svn-dcommit-clobber-series.sh
+6
@@ -53,4 +53,10 @@ test_expect_success 'change file but in unrelated area' "
53 test x\"\`sed -n -e 61p < file\`\" = x6611
54 "
55
56 +test_expect_failure 'attempt to dcommit with a dirty index' '
57 + echo foo >>file &&
58 + git add file &&
59 + git svn dcommit
60 +'
61 +
62 test_done