X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=dgit;h=d1bf2136a6d86550f847e5d071322a3227885864;hb=242ba73109ae30e7d8849b01f0c668b87d4f4d63;hp=944de8592418be52f5fae781bdf2447a4439f418;hpb=83af484ee17f5d18ee6a161b01aa0b546d8943cb;p=dgit.git diff --git a/dgit b/dgit index 944de859..d1bf2136 100755 --- a/dgit +++ b/dgit @@ -4910,14 +4910,21 @@ sub quiltify_trees_differ ($$;$$$) { if ($unrepres) { eval { - die "not a plain file\n" - unless $newmode =~ m/^10\d{4}$/ || - $oldmode =~ m/^10\d{4}$/; + die "not a plain file or symlink\n" + unless $newmode =~ m/^(?:10|12)\d{4}$/ || + $oldmode =~ m/^(?:10|12)\d{4}$/; if ($oldmode =~ m/[^0]/ && $newmode =~ m/[^0]/) { - die "mode changed\n" if $oldmode ne $newmode; + # both old and new files exist + die "mode or type changed\n" if $oldmode ne $newmode; + die "modified symlink\n" unless $newmode =~ m/^10/; + } elsif ($oldmode =~ m/[^0]/) { + # deletion + die "deletion of symlink\n" + unless $oldmode =~ m/^10/; } else { - die "non-default mode\n" + # creation + die "non-default mode or type\n" unless $newmode =~ m/^100644$/ || $oldmode =~ m/^100644$/; } @@ -6365,6 +6372,8 @@ END $there =~ s#/+[^/]+$## or 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);