Merge branch 'jc/mv' into next

* jc/mv:
  Allow git-mv to accept ./ in paths.
  Merge fixes up to GIT 1.2.2
  Fix retries in git-cvsimport
  archimport: remove files from the index before adding/updating
This commit is contained in:
Junio C Hamano 2006-02-18 23:43:54 -08:00
commit 0d27c3f699
3 changed files with 27 additions and 23 deletions

View File

@ -346,12 +346,10 @@ sub process_patchset_accurate {
}
# update the index with all the changes we got
system('git-diff-files --name-only -z | '.
'git-update-index --remove -z --stdin') == 0 or die "$! $?\n";
system('git-ls-files --others -z | '.
'git-update-index --add -z --stdin') == 0 or die "$! $?\n";
system('git-ls-files --deleted -z | '.
'git-update-index --remove -z --stdin') == 0 or die "$! $?\n";
system('git-ls-files -z | '.
'git-update-index -z --stdin') == 0 or die "$! $?\n";
return 1;
}
@ -416,22 +414,14 @@ sub process_patchset_fast {
# imports don't give us good info
# on added files. Shame on them
if ($ps->{type} eq 'i' || $ps->{type} eq 't') {
system('git-ls-files --others -z | '.
'git-update-index --add -z --stdin') == 0 or die "$! $?\n";
system('git-ls-files --deleted -z | '.
'git-update-index --remove -z --stdin') == 0 or die "$! $?\n";
system('git-ls-files --others -z | '.
'git-update-index --add -z --stdin') == 0 or die "$! $?\n";
}
# TODO: handle removed_directories and renamed_directories:
if (my $add = $ps->{new_files}) {
while (@$add) {
my @slice = splice(@$add, 0, 100);
system('git-update-index','--add','--',@slice) == 0 or
die "Error in git-update-index --add: $! $?\n";
}
}
if (my $del = $ps->{removed_files}) {
unlink @$del;
while (@$del) {
@ -462,6 +452,14 @@ sub process_patchset_fast {
}
}
if (my $add = $ps->{new_files}) {
while (@$add) {
my @slice = splice(@$add, 0, 100);
system('git-update-index','--add','--',@slice) == 0 or
die "Error in git-update-index --add: $! $?\n";
}
}
if (my $mod = $ps->{modified_files}) {
while (@$mod) {
my @slice = splice(@$mod, 0, 100);

View File

@ -361,6 +361,7 @@ sub _line {
}
}
}
return undef;
}
sub file {
my($self,$fn,$rev) = @_;
@ -372,19 +373,15 @@ sub file {
$self->_file($fn,$rev) and $res = $self->_line($fh);
if (!defined $res) {
# retry
print STDERR "Server has gone away while fetching $fn $rev, retrying...\n";
truncate $fh, 0;
$self->conn();
$self->_file($fn,$rev)
or die "No file command send\n";
$self->_file($fn,$rev) or die "No file command send";
$res = $self->_line($fh);
die "No input: $fn $rev\n" unless defined $res;
die "Retry failed" unless defined $res;
}
close ($fh);
if ($res eq '') {
die "Looks like the server has gone away while fetching $fn $rev -- exiting!";
}
return ($name, $res);
}

View File

@ -75,6 +75,15 @@ while(scalar @srcArgs > 0) {
$dst = shift @dstArgs;
$bad = "";
for ($src, $dst) {
# Be nicer to end-users by doing ".//a/./b/.//./c" ==> "a/b/c"
s|^\./||;
s|/\./|/| while (m|/\./|);
s|//+|/|g;
# Also "a/b/../c" ==> "a/c"
1 while (s,(^|/)[^/]+/\.\./,$1,);
}
if ($opt_v) {
print "Checking rename of '$src' to '$dst'\n";
}