chiark / gitweb /
dgit import: Avoid making broken symlinks in ..
[dgit.git] / dgit
diff --git a/dgit b/dgit
index a68bf19c943502d3f039440caa29368ab2a388d9..dd3b31c717a60ab0562420f3fce5f3a439a8d929 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -6363,8 +6363,10 @@ END
            fail "cannot import $dscfn which seems to be inside working tree!";
        }
        $there =~ s#/+[^/]+$## or
-           fail "cannot import $dscfn which seems to not have a basename";
+           fail "import $dscfn requires ../$f, but it does not exist";
        $there .= "/$f";
+       my $test = $there =~ m{^/} ? $there : "../$there";
+       stat $test or fail "import $dscfn requires $test, but: $!";
        symlink $there, $here or fail "symlink $there to $here: $!";
        progress "made symlink $here -> $there";
 #      print STDERR Dumper($fi);