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>
This commit is contained in:

committed by
Junio C Hamano

parent
a91ef6e75b
commit
c8cfa3e4a5
@ -374,6 +374,9 @@ sub cmd_set_tree {
|
|||||||
|
|
||||||
sub cmd_dcommit {
|
sub cmd_dcommit {
|
||||||
my $head = shift;
|
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';
|
$head ||= 'HEAD';
|
||||||
my @refs;
|
my @refs;
|
||||||
my ($url, $rev, $uuid, $gs) = working_head_info($head, \@refs);
|
my ($url, $rev, $uuid, $gs) = working_head_info($head, \@refs);
|
||||||
|
@ -53,4 +53,10 @@ test_expect_success 'change file but in unrelated area' "
|
|||||||
test x\"\`sed -n -e 61p < file\`\" = x6611
|
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
|
test_done
|
||||||
|
Reference in New Issue
Block a user