summaryrefslogtreecommitdiff
path: root/sha1-name.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2020-03-05 10:43:03 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-03-05 10:43:03 -0800
commite8e71848ea866d7dc34eacffc20b9c3826ae29a1 (patch)
tree3baa258f1b1a5671948b7677169b0af70a06dc06 /sha1-name.c
parentMerge branch 'es/do-not-let-rebase-switch-to-protected-branch' (diff)
parentpackfile: drop nth_packed_object_sha1() (diff)
downloadtgif-e8e71848ea866d7dc34eacffc20b9c3826ae29a1.tar.xz
Merge branch 'jk/nth-packed-object-id'
Code cleanup to use "struct object_id" more by replacing use of "char *sha1" * jk/nth-packed-object-id: packfile: drop nth_packed_object_sha1() packed_object_info(): use object_id internally for delta base packed_object_info(): use object_id for returning delta base pack-check: push oid lookup into loop pack-check: convert "internal error" die to a BUG() pack-bitmap: use object_id when loading on-disk bitmaps pack-objects: use object_id struct in pack-reuse code pack-objects: convert oe_set_delta_ext() to use object_id pack-objects: read delta base oid into object_id struct nth_packed_object_oid(): use customary integer return
Diffstat (limited to 'sha1-name.c')
-rw-r--r--sha1-name.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/sha1-name.c b/sha1-name.c
index f2e24ea666..5bb006e5a9 100644
--- a/sha1-name.c
+++ b/sha1-name.c
@@ -155,7 +155,6 @@ static void unique_in_pack(struct packed_git *p,
struct disambiguate_state *ds)
{
uint32_t num, i, first = 0;
- const struct object_id *current = NULL;
if (p->multi_pack_index)
return;
@@ -173,10 +172,10 @@ static void unique_in_pack(struct packed_git *p,
*/
for (i = first; i < num && !ds->ambiguous; i++) {
struct object_id oid;
- current = nth_packed_object_oid(&oid, p, i);
- if (!match_sha(ds->len, ds->bin_pfx.hash, current->hash))
+ nth_packed_object_id(&oid, p, i);
+ if (!match_sha(ds->len, ds->bin_pfx.hash, oid.hash))
break;
- update_candidates(ds, current);
+ update_candidates(ds, &oid);
}
}
@@ -643,14 +642,14 @@ static void find_abbrev_len_for_pack(struct packed_git *p,
*/
mad->init_len = 0;
if (!match) {
- if (nth_packed_object_oid(&oid, p, first))
+ if (!nth_packed_object_id(&oid, p, first))
extend_abbrev_len(&oid, mad);
} else if (first < num - 1) {
- if (nth_packed_object_oid(&oid, p, first + 1))
+ if (!nth_packed_object_id(&oid, p, first + 1))
extend_abbrev_len(&oid, mad);
}
if (first > 0) {
- if (nth_packed_object_oid(&oid, p, first - 1))
+ if (!nth_packed_object_id(&oid, p, first - 1))
extend_abbrev_len(&oid, mad);
}
mad->init_len = mad->cur_len;