diff options
-rwxr-xr-x | git-svn.perl | 3 | ||||
-rwxr-xr-x | t/t9106-git-svn-dcommit-clobber-series.sh | 6 |
2 files changed, 9 insertions, 0 deletions
diff --git a/git-svn.perl b/git-svn.perl index ec25ea423..4c779b6c6 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -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); diff --git a/t/t9106-git-svn-dcommit-clobber-series.sh b/t/t9106-git-svn-dcommit-clobber-series.sh index 7eff4cdc0..d59acc8d1 100755 --- a/t/t9106-git-svn-dcommit-clobber-series.sh +++ b/t/t9106-git-svn-dcommit-clobber-series.sh @@ -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 |