summaryrefslogtreecommitdiff
path: root/fast-import.c
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-01-16 05:44:48 (GMT)
committerShawn O. Pearce <spearce@spearce.org>2007-01-16 05:44:48 (GMT)
commit09543c96bbe41d312bc002c293a193aa328c839d (patch)
tree4443bde80b42496c378930d8325867e5e017a1f3 /fast-import.c
parent6cf092619376f5bf60987f146d142497ded2f718 (diff)
downloadgit-09543c96bbe41d312bc002c293a193aa328c839d.zip
git-09543c96bbe41d312bc002c293a193aa328c839d.tar.gz
git-09543c96bbe41d312bc002c293a193aa328c839d.tar.bz2
Reuse sha1 in packed_git in fast-import.
Rather than maintaing our own packfile level sha1 variable we can make use of the one already available in struct packed_git. Its meant for the SHA1 of the index but it can also hold the SHA1 of the packfile itself between final checksumming of the packfile and creation of the index. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'fast-import.c')
-rw-r--r--fast-import.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/fast-import.c b/fast-import.c
index 938707c..5767e80 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -248,7 +248,6 @@ static struct packed_git *pack_data;
static struct packed_git **all_packs;
static int pack_fd;
static unsigned long pack_size;
-static unsigned char pack_sha1[20];
/* Table of objects we've written. */
static unsigned int object_entry_alloc = 5000;
@@ -646,8 +645,8 @@ static void fixup_header_footer()
}
free(buf);
- SHA1_Final(pack_sha1, &c);
- write_or_die(pack_fd, pack_sha1, sizeof(pack_sha1));
+ SHA1_Final(pack_data->sha1, &c);
+ write_or_die(pack_fd, pack_data->sha1, sizeof(pack_data->sha1));
}
static int oecmp (const void *a_, const void *b_)
@@ -697,8 +696,8 @@ static void write_index(const char *idx_name)
sha1write(f, &offset, 4);
sha1write(f, (*c)->sha1, sizeof((*c)->sha1));
}
- sha1write(f, pack_sha1, sizeof(pack_sha1));
- sha1close(f, NULL, 1);
+ sha1write(f, pack_data->sha1, sizeof(pack_data->sha1));
+ sha1close(f, pack_data->sha1, 1);
free(idx);
}