summaryrefslogtreecommitdiff
path: root/bulk-checkin.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-05-05 21:00:23 -0700
committerJunio C Hamano <gitster@pobox.com>2015-05-05 21:00:23 -0700
commita916cb5fb4824322d7e99b1b0efad4e6d7850e78 (patch)
treed9ccc322b7b02d3af296ef313df8dc046ca3fc7d /bulk-checkin.c
parent3d4a3ffe64162b45ae7c991fc60623ecb4678cfd (diff)
parentd07d4ab401173a10173f2747cf5e0f074b6d2b39 (diff)
downloadgit-a916cb5fb4824322d7e99b1b0efad4e6d7850e78.tar.gz
Merge branch 'bc/object-id'
Identify parts of the code that knows that we use SHA-1 hash to name our objects too much, and use (1) symbolic constants instead of hardcoded 20 as byte count and/or (2) use struct object_id instead of unsigned char [20] for object names. * bc/object-id: apply: convert threeway_stage to object_id patch-id: convert to use struct object_id commit: convert parts to struct object_id diff: convert struct combine_diff_path to object_id bulk-checkin.c: convert to use struct object_id zip: use GIT_SHA1_HEXSZ for trailers archive.c: convert to use struct object_id bisect.c: convert leaf functions to use struct object_id define utility functions for object IDs define a structure for object IDs
Diffstat (limited to 'bulk-checkin.c')
-rw-r--r--bulk-checkin.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/bulk-checkin.c b/bulk-checkin.c
index 8d157eba45..7cffc3a579 100644
--- a/bulk-checkin.c
+++ b/bulk-checkin.c
@@ -24,7 +24,7 @@ static struct bulk_checkin_state {
static void finish_bulk_checkin(struct bulk_checkin_state *state)
{
- unsigned char sha1[20];
+ struct object_id oid;
struct strbuf packname = STRBUF_INIT;
int i;
@@ -36,11 +36,11 @@ static void finish_bulk_checkin(struct bulk_checkin_state *state)
unlink(state->pack_tmp_name);
goto clear_exit;
} else if (state->nr_written == 1) {
- sha1close(state->f, sha1, CSUM_FSYNC);
+ sha1close(state->f, oid.hash, CSUM_FSYNC);
} else {
- int fd = sha1close(state->f, sha1, 0);
- fixup_pack_header_footer(fd, sha1, state->pack_tmp_name,
- state->nr_written, sha1,
+ int fd = sha1close(state->f, oid.hash, 0);
+ fixup_pack_header_footer(fd, oid.hash, state->pack_tmp_name,
+ state->nr_written, oid.hash,
state->offset);
close(fd);
}
@@ -48,7 +48,7 @@ static void finish_bulk_checkin(struct bulk_checkin_state *state)
strbuf_addf(&packname, "%s/pack/pack-", get_object_directory());
finish_tmp_packfile(&packname, state->pack_tmp_name,
state->written, state->nr_written,
- &state->pack_idx_opts, sha1);
+ &state->pack_idx_opts, oid.hash);
for (i = 0; i < state->nr_written; i++)
free(state->written[i]);