Skip to content

Commit

Permalink
git-svn: prevent dcommitting if the index is dirty.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Benoit Sigoure authored and Junio C Hamano committed Nov 12, 2007
1 parent a91ef6e commit c8cfa3e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions git-svn.perl
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions t/t9106-git-svn-dcommit-clobber-series.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit c8cfa3e

Please sign in to comment.