summaryrefslogtreecommitdiff
path: root/git-svn.perl
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2007-02-15 00:29:52 (GMT)
committerEric Wong <normalperson@yhbt.net>2007-02-23 08:57:12 (GMT)
commite8d120bd5a7e09b24c6fa2245cf429e3411028ee (patch)
tree3015e2c4190a4f213e0865b50c9d37839b87c6c9 /git-svn.perl
parent6af1db447b10c03db4c04a55000efaa9aad38caa (diff)
downloadgit-e8d120bd5a7e09b24c6fa2245cf429e3411028ee.zip
git-e8d120bd5a7e09b24c6fa2245cf429e3411028ee.tar.gz
git-e8d120bd5a7e09b24c6fa2245cf429e3411028ee.tar.bz2
git-svn: remember to check for clean indices on globbed refs, too
Also, warn about dirty indices and avoid an unncessary write-tree call if the index is clean. Signed-off-by: Eric Wong <normalperson@yhbt.net>
Diffstat (limited to 'git-svn.perl')
-rwxr-xr-xgit-svn.perl15
1 files changed, 8 insertions, 7 deletions
diff --git a/git-svn.perl b/git-svn.perl
index 8a80f81..ace3102 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -1269,10 +1269,11 @@ sub assert_index_clean {
my $x = command_oneline('write-tree');
my ($y) = (command(qw/cat-file commit/, $treeish) =~
/^tree ($::sha1)/mo);
- if ($y ne $x) {
- unlink $self->{index} or croak $!;
- command_noisy('read-tree', $treeish);
- }
+ return if $y eq $x;
+
+ warn "Index mismatch: $y != $x\nrereading $treeish\n";
+ unlink $self->{index} or die "unlink $self->{index}: $!\n";
+ command_noisy('read-tree', $treeish);
$x = command_oneline('write-tree');
if ($y ne $x) {
::fatal "trees ($treeish) $y != $x\n",
@@ -2755,9 +2756,6 @@ sub gs_fetch_loop_common {
my $common_max = scalar @$gsv;
foreach my $gs (@$gsv) {
- if (my $last_commit = $gs->last_commit) {
- $gs->assert_index_clean($last_commit);
- }
my @tmp = split m#/#, $gs->{path};
my $p = '';
foreach (@tmp) {
@@ -2833,6 +2831,9 @@ sub gs_fetch_loop_common {
}
next unless $gs->match_paths($paths, $r);
$gs->{logged_rev_props} = $logged;
+ if (my $last_commit = $gs->last_commit) {
+ $gs->assert_index_clean($last_commit);
+ }
my $log_entry = $gs->do_fetch($paths, $r);
if ($log_entry) {
$gs->do_git_commit($log_entry);