Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
tar-tree: Use SHA1 of root tree for the basedir
author
Rene Scharfe
<rene.scharfe@lsrfire.ath.cx>
Sat, 25 Mar 2006 22:21:02 +0000
(23:21 +0100)
committer
Junio C Hamano
<junkio@cox.net>
Sun, 26 Mar 2006 00:34:37 +0000
(16:34 -0800)
... instead of the made-up "0".
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
tar-tree.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
c150462
)
diff --git
a/tar-tree.c
b/tar-tree.c
index e478e13e283a9d9687d0b32e180558995f2b920d..32f226ea5c30895df5bd21e28fcdf5e15ca3980e 100644
(file)
--- a/
tar-tree.c
+++ b/
tar-tree.c
@@
-375,7
+375,7
@@
static void traverse_tree(struct tree_desc *tree,
int main(int argc, char **argv)
{
int main(int argc, char **argv)
{
- unsigned char sha1[20];
+ unsigned char sha1[20]
, tree_sha1[20]
;
struct commit *commit;
struct tree_desc tree;
struct commit *commit;
struct tree_desc tree;
@@
-398,14
+398,15
@@
int main(int argc, char **argv)
write_global_extended_header(commit->object.sha1);
archive_time = commit->date;
}
write_global_extended_header(commit->object.sha1);
archive_time = commit->date;
}
- tree.buf = read_object_with_reference(sha1, "tree", &tree.size, NULL);
+ tree.buf = read_object_with_reference(sha1, "tree", &tree.size,
+ tree_sha1);
if (!tree.buf)
die("not a reference to a tag, commit or tree object: %s",
sha1_to_hex(sha1));
if (!archive_time)
archive_time = time(NULL);
if (basedir)
if (!tree.buf)
die("not a reference to a tag, commit or tree object: %s",
sha1_to_hex(sha1));
if (!archive_time)
archive_time = time(NULL);
if (basedir)
- write_header(
(unsigned char *)"0"
, TYPEFLAG_DIR, NULL, NULL,
+ write_header(
tree_sha1
, TYPEFLAG_DIR, NULL, NULL,
basedir, 040777, NULL, 0);
traverse_tree(&tree, NULL);
write_trailer();
basedir, 040777, NULL, 0);
traverse_tree(&tree, NULL);
write_trailer();