Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerrit Pape <pape@smarden.org>2007-02-04 01:38:59 +0300
committerJunio C Hamano <junkio@cox.net>2007-02-05 04:05:16 +0300
commit11dbe9e88016f3894eda79c7437f6c3bf79e155e (patch)
tree08520ced63099d00412116f44301dae6f86a13a8 /git-archimport.perl
parent756373da254dbe8bd03bd83ec658d3f015fee958 (diff)
git-archimport: initial import needs empty directory
git-archimport should better refuse to start an initial import if the current directory is not empty. (http://bugs.debian.org/400508) Signed-off-by: Gerrit Pape <pape@smarden.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-archimport.perl')
-rwxr-xr-xgit-archimport.perl9
1 files changed, 9 insertions, 0 deletions
diff --git a/git-archimport.perl b/git-archimport.perl
index 2e15781246..66aaeae102 100755
--- a/git-archimport.perl
+++ b/git-archimport.perl
@@ -95,6 +95,15 @@ $ENV{'TMPDIR'} = $opt_t if $opt_t; # $ENV{TMPDIR} will affect tempdir() calls:
my $tmp = tempdir('git-archimport-XXXXXX', TMPDIR => 1, CLEANUP => 1);
$opt_v && print "+ Using $tmp as temporary directory\n";
+unless (-d $git_dir) { # initial import needs empty directory
+ opendir DIR, '.' or die "Unable to open current directory: $!\n";
+ while (my $entry = readdir DIR) {
+ $entry =~ /^\.\.?$/ or
+ die "Initial import needs an empty current working directory.\n"
+ }
+ closedir DIR
+}
+
my %reachable = (); # Arch repositories we can access
my %unreachable = (); # Arch repositories we can't access :<
my @psets = (); # the collection