aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-02-18 23:43:54 -0800
committerJunio C Hamano <junkio@cox.net>2006-02-18 23:43:54 -0800
commit0d27c3f699eb4d9268449a867901c8cc5f36efd6 (patch)
tree9d6a8c3cba8cac64249273bc66f6f47d2f62160f
parent1a9366c0d48dbac3f728a1c6ff0da0fb7fd95353 (diff)
parent9a0e6731c632c841cd2de9dec0b9091b2f10c6fd (diff)
downloadgit-0d27c3f699eb4d9268449a867901c8cc5f36efd6.tar.gz
git-0d27c3f699eb4d9268449a867901c8cc5f36efd6.tar.xz
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
-rwxr-xr-xgit-archimport.perl28
-rwxr-xr-xgit-cvsimport.perl13
-rwxr-xr-xgit-mv.perl9
3 files changed, 27 insertions, 23 deletions
diff --git a/git-archimport.perl b/git-archimport.perl
index 841738d5c..6792624d4 100755
--- a/git-archimport.perl
+++ b/git-archimport.perl
@@ -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);
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index 00fc3bacd..24f983434 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -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);
}
diff --git a/git-mv.perl b/git-mv.perl
index 83dc7e45c..2ea852c91 100755
--- a/git-mv.perl
+++ b/git-mv.perl
@@ -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";
}