Store the sha1 of the tree that is being committed, rather than a sha1 of a commit...
authorJoey Hess <joey@kitenet.net>
Sun, 11 Mar 2012 22:49:10 +0000 (18:49 -0400)
committerJoey Hess <joey@kitenet.net>
Sun, 11 Mar 2012 22:49:10 +0000 (18:49 -0400)
debian/changelog
pristine-tar

index de2c6cf..5f91b71 100644 (file)
@@ -1,3 +1,12 @@
+pristine-tar (1.22) UNRELEASED; urgency=low
+
+  * Store the sha1 of the tree that is being committed, rather than
+    a sha1 of a commit or other object that points to the tree.
+    This makes committed tarballs more resilient against git filter-branch
+    when it's only used to change commit metadata. Closes: #467288
+
+ -- Joey Hess <joeyh@debian.org>  Sun, 11 Mar 2012 18:46:31 -0400
+
 pristine-tar (1.21) unstable; urgency=low
 
   * Fix bug in mtime resetting code, which caused delta files to be created
index ea3af7a..2bc3f52 100755 (executable)
@@ -577,6 +577,13 @@ sub export {
                        }
                }
 
+               # We have an id that is probably a commit. Let's get to the
+               # id of the actual tree instead. This makes us more robust
+               # against any later changes to the commit.
+               my $treeid=`git rev-parse '$id^{tree}'`;
+               chmomp $treeid;
+               $id = $treeid if length $treeid;
+
                doit("git archive --format=tar \Q$id\E | (cd '$dest' && tar x)");
        }
        else {