@@ -375,7 +375,7 @@ static void traverse_tree(struct tree_desc *tree,
375
375
376
376
int main (int argc , char * * argv )
377
377
{
378
- unsigned char sha1 [20 ];
378
+ unsigned char sha1 [20 ], tree_sha1 [ 20 ] ;
379
379
struct commit * commit ;
380
380
struct tree_desc tree ;
381
381
@@ -398,14 +398,15 @@ int main(int argc, char **argv)
398
398
write_global_extended_header (commit -> object .sha1 );
399
399
archive_time = commit -> date ;
400
400
}
401
- tree .buf = read_object_with_reference (sha1 , "tree" , & tree .size , NULL );
401
+ tree .buf = read_object_with_reference (sha1 , "tree" , & tree .size ,
402
+ tree_sha1 );
402
403
if (!tree .buf )
403
404
die ("not a reference to a tag, commit or tree object: %s" ,
404
405
sha1_to_hex (sha1 ));
405
406
if (!archive_time )
406
407
archive_time = time (NULL );
407
408
if (basedir )
408
- write_header (( unsigned char * ) "0" , TYPEFLAG_DIR , NULL , NULL ,
409
+ write_header (tree_sha1 , TYPEFLAG_DIR , NULL , NULL ,
409
410
basedir , 040777 , NULL , 0 );
410
411
traverse_tree (& tree , NULL );
411
412
write_trailer ();
0 commit comments