[PATCH] Update git-tag-script to create the .git/refs/tags if it does not already...
[git.git] / tar-tree.c
index 233a256..673ac66 100644 (file)
@@ -73,16 +73,13 @@ static char *get_record(void)
  */
 static void write_trailer(void)
 {
-       memset(block + offset, 0, RECORDSIZE);
-       offset += RECORDSIZE;
+       get_record();
        write_if_needed();
-       memset(block + offset, 0, RECORDSIZE);
-       offset += RECORDSIZE;
+       get_record();
        write_if_needed();
-       if (offset) {
-               memset(block + offset, 0, BLOCKSIZE - offset);
-               reliable_write(block, BLOCKSIZE);
-               offset = 0;
+       while (offset) {
+               get_record();
+               write_if_needed();
        }
 }
 
@@ -433,8 +430,8 @@ int main(int argc, char **argv)
        if (!archive_time)
                archive_time = time(NULL);
        if (basedir)
-               write_header("0", TYPEFLAG_DIR, NULL, NULL, basedir, 040755,
-                            NULL, 0);
+               write_header((unsigned char *)"0", TYPEFLAG_DIR, NULL, NULL,
+                       basedir, 040755, NULL, 0);
        traverse_tree(buffer, size, NULL);
        free(buffer);
        write_trailer();