From 6ab7787ac3a8411e46bb18203b4ab5c0e666e9d5 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 11 Mar 2012 18:49:10 -0400 Subject: [PATCH] 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 --- debian/changelog | 9 +++++++++ pristine-tar | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/debian/changelog b/debian/changelog index de2c6cf..5f91b71 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 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 diff --git a/pristine-tar b/pristine-tar index ea3af7a..2bc3f52 100755 --- a/pristine-tar +++ b/pristine-tar @@ -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 { -- 2.7.4