aboutsummaryrefslogtreecommitdiff
path: root/contrib/fast-import
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2009-06-17 14:49:39 +0200
committerJunio C Hamano <gitster@pobox.com>2009-06-18 09:53:53 -0700
commit6fb37f86bce7cf19b4dbff2aa8a93df5ac5c4cbe (patch)
tree8d841b035b031248fb3088f90092d089e9feeeb6 /contrib/fast-import
parentbc2bbc4542a220da5d28c432b6bf78a845a421c0 (diff)
downloadgit-6fb37f86bce7cf19b4dbff2aa8a93df5ac5c4cbe.tar.gz
git-6fb37f86bce7cf19b4dbff2aa8a93df5ac5c4cbe.tar.xz
import-tars: support symlinks
Without this patch, symbolic links are turned into empty files. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/fast-import')
-rwxr-xr-xcontrib/fast-import/import-tars.perl17
1 files changed, 12 insertions, 5 deletions
diff --git a/contrib/fast-import/import-tars.perl b/contrib/fast-import/import-tars.perl
index 6309d146e..78e40d2a1 100755
--- a/contrib/fast-import/import-tars.perl
+++ b/contrib/fast-import/import-tars.perl
@@ -82,10 +82,16 @@ foreach my $tar_file (@ARGV)
$mtime = oct $mtime;
next if $typeflag == 5; # directory
- print FI "blob\n", "mark :$next_mark\n", "data $size\n";
- while ($size > 0 && read(I, $_, 512) == 512) {
- print FI substr($_, 0, $size);
- $size -= 512;
+ print FI "blob\n", "mark :$next_mark\n";
+ if ($typeflag == 2) { # symbolic link
+ print FI "data ", length($linkname), "\n", $linkname;
+ $mode = 0120000;
+ } else {
+ print FI "data $size\n";
+ while ($size > 0 && read(I, $_, 512) == 512) {
+ print FI substr($_, 0, $size);
+ $size -= 512;
+ }
}
print FI "\n";
@@ -118,7 +124,8 @@ EOF
{
my ($mark, $mode) = @{$files{$path}};
$path =~ s,^([^/]+)/,, if $have_top_dir;
- printf FI "M %o :%i %s\n", $mode & 0111 ? 0755 : 0644, $mark, $path;
+ $mode = $mode & 0111 ? 0755 : 0644 unless $mode == 0120000;
+ printf FI "M %o :%i %s\n", $mode, $mark, $path;
}
print FI "\n";