projects
/
git.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
git-upload-pack: More efficient usage of the has_sha1 array
[git.git]
/
git-archimport.perl
diff --git
a/git-archimport.perl
b/git-archimport.perl
index
518a0ea
..
980e827
100755
(executable)
--- a/
git-archimport.perl
+++ b/
git-archimport.perl
@@
-23,7
+23,6
@@
See man (1) git-archimport for more details.
- create tag objects instead of ref tags
- audit shell-escaping of filenames
- create tag objects instead of ref tags
- audit shell-escaping of filenames
- - better handling of temp directories
- hide our private tags somewhere smarter
- find a way to make "cat *patches | patch" safe even when patchfiles are missing newlines
- hide our private tags somewhere smarter
- find a way to make "cat *patches | patch" safe even when patchfiles are missing newlines
@@
-37,7
+36,7
@@
use strict;
use warnings;
use Getopt::Std;
use File::Spec;
use warnings;
use Getopt::Std;
use File::Spec;
-use File::Temp qw(tempfile);
+use File::Temp qw(tempfile
tempdir
);
use File::Path qw(mkpath);
use File::Basename qw(basename dirname);
use String::ShellQuote;
use File::Path qw(mkpath);
use File::Basename qw(basename dirname);
use String::ShellQuote;
@@
-72,9
+71,10
@@
usage if $opt_h;
@ARGV >= 1 or usage();
my @arch_roots = @ARGV;
@ARGV >= 1 or usage();
my @arch_roots = @ARGV;
-my $tmp = $opt_t;
-$tmp ||= '/tmp';
-$tmp .= '/git-archimport/';
+my ($tmpdir, $tmpdirname) = tempdir('git-archimport-XXXXXX', TMPDIR => 1, CLEANUP => 1);
+my $tmp = $opt_t || 1;
+$tmp = tempdir('git-archimport-XXXXXX', TMPDIR => 1, CLEANUP => 1);
+$opt_v && print "+ Using $tmp as temporary directory\n";
my @psets = (); # the collection
my %psets = (); # the collection, by name
my @psets = (); # the collection
my %psets = (); # the collection, by name
@@
-228,10
+228,12
@@
foreach my $ps (@psets) {
# skip commits already in repo
#
if (ptag($ps->{id})) {
# skip commits already in repo
#
if (ptag($ps->{id})) {
- $opt_v && print "Skipping already imported: $ps->{id}\n";
+ $opt_v && print "
*
Skipping already imported: $ps->{id}\n";
next;
}
next;
}
+ print " * Starting to work on $ps->{id}\n";
+
#
# create the branch if needed
#
#
# create the branch if needed
#
@@
-675,6
+677,10
@@
sub find_parents {
# that branch.
#
foreach my $branch (keys %branches) {
# that branch.
#
foreach my $branch (keys %branches) {
+
+ # check that we actually know about the branch
+ next unless -e "$git_dir/refs/heads/$branch";
+
my $mergebase = `git-merge-base $branch $ps->{branch}`;
die "Cannot find merge base for $branch and $ps->{branch}" if $?;
chomp $mergebase;
my $mergebase = `git-merge-base $branch $ps->{branch}`;
die "Cannot find merge base for $branch and $ps->{branch}" if $?;
chomp $mergebase;