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:
commit
0d27c3f699
@ -346,12 +346,10 @@ sub process_patchset_accurate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# update the index with all the changes we got
|
# 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 | '.
|
system('git-ls-files --others -z | '.
|
||||||
'git-update-index --add -z --stdin') == 0 or die "$! $?\n";
|
'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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -416,22 +414,14 @@ sub process_patchset_fast {
|
|||||||
# imports don't give us good info
|
# imports don't give us good info
|
||||||
# on added files. Shame on them
|
# on added files. Shame on them
|
||||||
if ($ps->{type} eq 'i' || $ps->{type} eq 't') {
|
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 | '.
|
system('git-ls-files --deleted -z | '.
|
||||||
'git-update-index --remove -z --stdin') == 0 or die "$! $?\n";
|
'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:
|
# 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}) {
|
if (my $del = $ps->{removed_files}) {
|
||||||
unlink @$del;
|
unlink @$del;
|
||||||
while (@$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}) {
|
if (my $mod = $ps->{modified_files}) {
|
||||||
while (@$mod) {
|
while (@$mod) {
|
||||||
my @slice = splice(@$mod, 0, 100);
|
my @slice = splice(@$mod, 0, 100);
|
||||||
|
@ -361,6 +361,7 @@ sub _line {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return undef;
|
||||||
}
|
}
|
||||||
sub file {
|
sub file {
|
||||||
my($self,$fn,$rev) = @_;
|
my($self,$fn,$rev) = @_;
|
||||||
@ -372,19 +373,15 @@ sub file {
|
|||||||
$self->_file($fn,$rev) and $res = $self->_line($fh);
|
$self->_file($fn,$rev) and $res = $self->_line($fh);
|
||||||
|
|
||||||
if (!defined $res) {
|
if (!defined $res) {
|
||||||
# retry
|
print STDERR "Server has gone away while fetching $fn $rev, retrying...\n";
|
||||||
|
truncate $fh, 0;
|
||||||
$self->conn();
|
$self->conn();
|
||||||
$self->_file($fn,$rev)
|
$self->_file($fn,$rev) or die "No file command send";
|
||||||
or die "No file command send\n";
|
|
||||||
$res = $self->_line($fh);
|
$res = $self->_line($fh);
|
||||||
die "No input: $fn $rev\n" unless defined $res;
|
die "Retry failed" unless defined $res;
|
||||||
}
|
}
|
||||||
close ($fh);
|
close ($fh);
|
||||||
|
|
||||||
if ($res eq '') {
|
|
||||||
die "Looks like the server has gone away while fetching $fn $rev -- exiting!";
|
|
||||||
}
|
|
||||||
|
|
||||||
return ($name, $res);
|
return ($name, $res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,6 +75,15 @@ while(scalar @srcArgs > 0) {
|
|||||||
$dst = shift @dstArgs;
|
$dst = shift @dstArgs;
|
||||||
$bad = "";
|
$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) {
|
if ($opt_v) {
|
||||||
print "Checking rename of '$src' to '$dst'\n";
|
print "Checking rename of '$src' to '$dst'\n";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user