summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1280158)
raw | patch | inline | side by side (parent: 1280158)
author | Shawn O. Pearce <spearce@spearce.org> | |
Tue, 16 Jan 2007 06:20:57 +0000 (01:20 -0500) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Tue, 16 Jan 2007 06:20:57 +0000 (01:20 -0500) |
Much like the pack_sha1 the pack_fd is an unnecessary global
variable, we already have the fd stored in our struct packed_git
*pack_data so that the core library functions in sha1_file.c are
able to lookup and decompress object data that we have previously
written. Keeping an extra copy of this value in our own variable
is just a hold-over from earlier versions of fast-import and is
now completely unnecessary.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
variable, we already have the fd stored in our struct packed_git
*pack_data so that the core library functions in sha1_file.c are
able to lookup and decompress object data that we have previously
written. Keeping an extra copy of this value in our own variable
is just a hold-over from earlier versions of fast-import and is
now completely unnecessary.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
fast-import.c | patch | blob | history |
diff --git a/fast-import.c b/fast-import.c
index a9cf22dfe22e19deba31724d67ad2f00b61c92b8..281b8f6a5ef2ad9c8dd83150ceb5dcf3cfd0d52d 100644 (file)
--- a/fast-import.c
+++ b/fast-import.c
static unsigned int pack_id;
static struct packed_git *pack_data;
static struct packed_git **all_packs;
-static int pack_fd;
static unsigned long pack_size;
/* Table of objects we've written. */
static char tmpfile[PATH_MAX];
struct packed_git *p;
struct pack_header hdr;
+ int pack_fd;
snprintf(tmpfile, sizeof(tmpfile),
"%s/pack_XXXXXX", get_object_directory());
hdr.hdr_signature = htonl(PACK_SIGNATURE);
hdr.hdr_version = htonl(2);
hdr.hdr_entries = 0;
- write_or_die(pack_fd, &hdr, sizeof(hdr));
+ write_or_die(p->pack_fd, &hdr, sizeof(hdr));
pack_data = p;
pack_size = sizeof(hdr);
static void fixup_header_footer()
{
+ int pack_fd = pack_data->pack_fd;
SHA_CTX c;
char hdr[8];
unsigned long cnt;
last->depth++;
hdrlen = encode_header(OBJ_OFS_DELTA, deltalen, hdr);
- write_or_die(pack_fd, hdr, hdrlen);
+ write_or_die(pack_data->pack_fd, hdr, hdrlen);
pack_size += hdrlen;
hdr[pos] = ofs & 127;
while (ofs >>= 7)
hdr[--pos] = 128 | (--ofs & 127);
- write_or_die(pack_fd, hdr + pos, sizeof(hdr) - pos);
+ write_or_die(pack_data->pack_fd, hdr + pos, sizeof(hdr) - pos);
pack_size += sizeof(hdr) - pos;
} else {
if (last)
last->depth = 0;
hdrlen = encode_header(type, datlen, hdr);
- write_or_die(pack_fd, hdr, hdrlen);
+ write_or_die(pack_data->pack_fd, hdr, hdrlen);
pack_size += hdrlen;
}
- write_or_die(pack_fd, out, s.total_out);
+ write_or_die(pack_data->pack_fd, out, s.total_out);
pack_size += s.total_out;
free(out);