Benoit Sigoure  committed c8cfa3e

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

Signed-off-by: Benoit Sigoure <>
Acked-by: Eric Wong <>
Signed-off-by: Junio C Hamano <>

  • Participants
  • Parent commits a91ef6e

Comments (0)

Files changed (2)

File git-svn.perl

 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);

File t/

 		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