chiark / gitweb /
If a .orig in .. is a symlink, hardlink the link target into our private unpack direc...
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 16 Aug 2015 12:30:01 +0000 (13:30 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 16 Aug 2015 12:30:01 +0000 (13:30 +0100)
Debian/Dgit.pm
debian/changelog
dgit

index ac44b9ab4c529f712a0c9322d2c1e2b146702250..fa85374150288cc53a1ef363042262315b76ab52 100644 (file)
@@ -17,7 +17,8 @@ BEGIN {
     @ISA         = qw(Exporter);
     @EXPORT      = qw(setup_sigwarn
                       debiantag server_branch server_ref
-                      stat_exists fail ensuredir executable_on_path
+                      stat_exists link_ltarget
+                      fail ensuredir executable_on_path
                       waitstatusmsg failedcmd
                       cmdoutput cmdoutput_errok
                       git_rev_parse git_get_ref git_for_each_ref
@@ -219,6 +220,15 @@ sub cmdoutput {
     return $d;
 }
 
+sub link_ltarget ($$) {
+    my ($old,$new) = @_;
+    lstat $old or return undef;
+    if (-l _) {
+       $old = cmdoutput qw(realpath  --), $old;
+    }
+    link $old, $new or die "link $old $new: $!";
+}
+
 sub git_rev_parse ($) {
     return cmdoutput qw(git rev-parse), "$_[0]~0";
 }
index 577b81a03b29142bb4b69b51069a3cd1cc5a6d50..1c5fbc4d8dec186f1de574925adb1cf4506ff313 100644 (file)
@@ -1,6 +1,9 @@
 dgit (1.3) unstable; urgency=low
 
   * In option parser test `@ARGV' not `length @ARGV'.  Closes:#795710.
+  * If a .orig in .. is a symlink, hardlink the link target into our
+    private unpack directory, rather than the link itself (since latter
+    won't work if the symlink is relative).
 
  --
 
diff --git a/dgit b/dgit
index 62cd049929cd7dd63a723f3902e26a14afd710d9..2d42f940f52c8f84c64f8ed6ac97c87786bcf60d 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -1382,7 +1382,7 @@ sub generate_commit_from_dsc () {
        my $f = $fi->{Filename};
        die "$f ?" if $f =~ m#/|^\.|\.dsc$|\.tmp$#;
 
-       link "../../../$f", $f
+       link_ltarget "../../../$f", $f
            or $!==&ENOENT
            or die "$f $!";
 
@@ -2794,7 +2794,7 @@ END
     foreach my $f (<../../../../*>) { #/){
        my $b=$f; $b =~ s{.*/}{};
        next unless is_orig_file $b, srcfn $upstreamversion,'';
-       link $f, $b or die "$b $!";
+       link_ltarget $f, $b or die "$b $!";
         $dscaddfile->($b);
     }