tag 463352 patch thanks Cyril Brulebois <[EMAIL PROTECTED]> (31/01/2008): > - modify the format of deltas so as to support empty directories > there. Already-existing trees (upstream branches, and their tags) > wouldn't have to be modified, it would just be needed (if there are > some directories in the original tarball) to update the deltas so > that these empty directories get represented and then later added > back to the generated tarballs.
Without having to modify the current format, one might want pristine-tar to assume that all missing files are empty directories, first patch. But one might want that only when an option is passed, second patch. I've been able to regenerate all 2.8 to 2.16.1 graphviz tarballs using this option, without even having to update the deltas. I guess the documentation could be adapted (as well as error messages) to suggest the use of this option when gentar breaks the way I mentioned in my original mail. > I don't think adding some strings representing empty directories > should bloat the deltas. OK, having had a look at the current format, what about adding a manifest-empty file to list the empty directories? BTW, delta-format.txt says format is 1.0, code says it is 2.0. Cheers, -- Cyril Brulebois
From eb9874dc455a603e05fa3f764339d8b9f16bd017 Mon Sep 17 00:00:00 2001
From: Cyril Brulebois <[EMAIL PROTECTED]>
Date: Thu, 31 Jan 2008 05:23:34 +0100
Subject: [PATCH] Assume every missing file in the manifest is an empty
directory.
---
pristine-tar | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/pristine-tar b/pristine-tar
index 90d80ae..2defb32 100755
--- a/pristine-tar
+++ b/pristine-tar
@@ -158,6 +158,7 @@ sub gentarball {
# for a given set of input files. So don't include file metadata
# in the tarball, since it can easily vary.
my $full_sweep=0;
+ my @missing=();
foreach my $file (@manifest) {
if (-l "$tempdir/workdir/$file") {
# Can't set timestamp of a symlink, so
@@ -169,6 +170,7 @@ sub gentarball {
elsif (! -e "$tempdir/workdir/$file") {
debug("$file is listed in the manifest but may not be
present in the source directory");
$full_sweep=1;
+ push @missing, $file;
}
if (-d "$tempdir/workdir/$file" && (-u _ || -g _ || -k _)) {
@@ -180,7 +182,14 @@ sub gentarball {
}
utime 0, 0, "$tempdir/workdir/$file" || die "utime: $!";
}
-
+
+ # Currently: assume every missing file is an empty directory.
+ # TODO: Check for an entry in manifest-empty and only mkpath
+ # in this case.
+ foreach my $file (@missing) {
+ mkpath "$tempdir/workdir/$file";
+ }
+
# If some files couldn't be matched up with the manifest,
# it's possible they do exist, but just with names that make sense
# to tar, but not to this program. To work around this and make sure
--
1.5.3.7
From 9241abbdc1b0c2b416bfd39ce5d230c3d9702b14 Mon Sep 17 00:00:00 2001
From: Cyril Brulebois <[EMAIL PROTECTED]>
Date: Thu, 31 Jan 2008 05:32:04 +0100
Subject: [PATCH]
=?utf-8?q?Add=20-e/--empty=20option=20to=20activate=20the=20=E2=80=9Cmissing=20files=20are=20empty=20directories=E2=80=9D=20mode.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
---
pristine-tar | 20 +++++++++++++++-----
1 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/pristine-tar b/pristine-tar
index 2defb32..c0f09d7 100755
--- a/pristine-tar
+++ b/pristine-tar
@@ -47,6 +47,13 @@ Debug mode.
Don't clean up the temporary directory on exit.
+=item -e
+
+When running gentar, assume missing files (from the manifest) are
+empty directories, and create them on the fly. Particularly useful
+when the revision control system doesn't track paths but rather
+content (which is the case of git).
+
=head1 AUTHOR
Joey Hess <[EMAIL PROTECTED]>
@@ -71,14 +78,15 @@ use constant GZIP_METHOD_DEFLATE => 0x08;
my $verbose=0;
my $debug=0;
my $keep=0;
-
+my $empty=0;
+
# Force locale to C since tar may output utf-8 filenames differently
# depending on the locale.
$ENV{LANG}='C';
sub usage {
- print STDERR "Usage: pristine-tar [-vdk] gentar delta tarball\n";
- print STDERR " pristine-tar [-vdk] gendelta tarball delta\n";
+ print STDERR "Usage: pristine-tar [-vdke] gentar delta tarball\n";
+ print STDERR " pristine-tar [-vdke] gendelta tarball delta\n";
}
sub debug {
@@ -183,11 +191,12 @@ sub gentarball {
utime 0, 0, "$tempdir/workdir/$file" || die "utime: $!";
}
- # Currently: assume every missing file is an empty directory.
+ # Currently: assume every missing file is an empty directory
+ # if the user asked for that behaviour.
# TODO: Check for an entry in manifest-empty and only mkpath
# in this case.
foreach my $file (@missing) {
- mkpath "$tempdir/workdir/$file";
+ mkpath "$tempdir/workdir/$file" if $empty;
}
# If some files couldn't be matched up with the manifest,
@@ -346,6 +355,7 @@ if (! GetOptions(
"v|verbose!" => \$verbose,
"d|debug!" => \$debug,
"k|keep!" => \$keep,
+ "e|empty!" => \$empty,
) || @ARGV != 3) {
usage();
exit 1;
--
1.5.3.7
pgpJnz5bXEOSk.pgp
Description: PGP signature

