Third batch
[gitweb.git] / archive-tar.c
index 29ca21649ee539e358ee584e91f35910eb40619a..e16d3f756ddd61d38477e73b71aa01e912ba2b13 100644 (file)
@@ -158,9 +158,9 @@ static void strbuf_append_ext_header(struct strbuf *sb, const char *keyword,
        strbuf_addch(sb, '\n');
 
        if (len != sb->len - orig_len)
-               warning("pax extended header length miscalculated as %"PRIuMAX
-                       ", should be %"PRIuMAX,
-                       (uintmax_t)len, (uintmax_t)(sb->len - orig_len));
+               BUG("pax extended header length miscalculated as %"PRIuMAX
+                   ", should be %"PRIuMAX,
+                   (uintmax_t)len, (uintmax_t)(sb->len - orig_len));
 }
 
 /*
@@ -332,14 +332,15 @@ static int write_tar_entry(struct archiver_args *args,
 
 static void write_global_extended_header(struct archiver_args *args)
 {
-       const unsigned char *sha1 = args->commit_sha1;
+       const struct object_id *oid = args->commit_oid;
        struct strbuf ext_header = STRBUF_INIT;
        struct ustar_header header;
        unsigned int mode;
 
-       if (sha1)
+       if (oid)
                strbuf_append_ext_header(&ext_header, "comment",
-                                        sha1_to_hex(sha1), 40);
+                                        oid_to_hex(oid),
+                                        the_hash_algo->hexsz);
        if (args->time > USTAR_MAX_MTIME) {
                strbuf_append_ext_header_uint(&ext_header, "mtime",
                                              args->time);