object-store: rename and expand packed_git's sha1 member

This member is used to represent the pack checksum of the pack in
question.  Expand this member to be GIT_MAX_RAWSZ bytes in length so it
works with longer hashes and rename it to be "hash" instead of "sha1".
This transformation was made with a change to the definition and the
following semantic patch:

@@
struct packed_git *E1;
@@
- E1->sha1
+ E1->hash

@@
struct packed_git E1;
@@
- E1.sha1
+ E1.hash

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
brian m. carlson
2019-02-19 00:05:03 +00:00
committed by Junio C Hamano
parent 0dbc6462ee
commit 538b152324
7 changed files with 24 additions and 21 deletions

13
http.c
View File

@ -2236,10 +2236,10 @@ int finish_http_pack_request(struct http_pack_request *preq)
return -1;
}
unlink(sha1_pack_index_name(p->sha1));
unlink(sha1_pack_index_name(p->hash));
if (finalize_object_file(preq->tmpfile.buf, sha1_pack_name(p->sha1))
|| finalize_object_file(tmp_idx, sha1_pack_index_name(p->sha1))) {
if (finalize_object_file(preq->tmpfile.buf, sha1_pack_name(p->hash))
|| finalize_object_file(tmp_idx, sha1_pack_index_name(p->hash))) {
free(tmp_idx);
return -1;
}
@ -2262,10 +2262,10 @@ struct http_pack_request *new_http_pack_request(
end_url_with_slash(&buf, base_url);
strbuf_addf(&buf, "objects/pack/pack-%s.pack",
sha1_to_hex(target->sha1));
sha1_to_hex(target->hash));
preq->url = strbuf_detach(&buf, NULL);
strbuf_addf(&preq->tmpfile, "%s.temp", sha1_pack_name(target->sha1));
strbuf_addf(&preq->tmpfile, "%s.temp", sha1_pack_name(target->hash));
preq->packfile = fopen(preq->tmpfile.buf, "a");
if (!preq->packfile) {
error("Unable to open local file %s for pack",
@ -2289,7 +2289,8 @@ struct http_pack_request *new_http_pack_request(
if (http_is_verbose)
fprintf(stderr,
"Resuming fetch of pack %s at byte %"PRIuMAX"\n",
sha1_to_hex(target->sha1), (uintmax_t)prev_posn);
sha1_to_hex(target->hash),
(uintmax_t)prev_posn);
http_opt_request_remainder(preq->slot->curl, prev_posn);
}