Skip to content

Commit 8b65a34

Browse files
stefanbellergitster
authored andcommitted
commit: convert lookup_commit_graft to struct object_id
With this patch, commit.h doesn't contain the string 'sha1' any more. Signed-off-by: Stefan Beller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 80145b1 commit 8b65a34

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

commit.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,11 @@ static void prepare_commit_graft(void)
199199
commit_graft_prepared = 1;
200200
}
201201

202-
struct commit_graft *lookup_commit_graft(const unsigned char *sha1)
202+
struct commit_graft *lookup_commit_graft(const struct object_id *oid)
203203
{
204204
int pos;
205205
prepare_commit_graft();
206-
pos = commit_graft_pos(sha1);
206+
pos = commit_graft_pos(oid->hash);
207207
if (pos < 0)
208208
return NULL;
209209
return commit_graft[pos];
@@ -335,7 +335,7 @@ int parse_commit_buffer(struct commit *item, const void *buffer, unsigned long s
335335
bufptr += tree_entry_len + 1; /* "tree " + "hex sha1" + "\n" */
336336
pptr = &item->parents;
337337

338-
graft = lookup_commit_graft(item->object.oid.hash);
338+
graft = lookup_commit_graft(&item->object.oid);
339339
while (bufptr + parent_entry_len < tail && !memcmp(bufptr, "parent ", 7)) {
340340
struct commit *new_parent;
341341

commit.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ typedef int (*each_commit_graft_fn)(const struct commit_graft *, void *);
249249

250250
struct commit_graft *read_graft_line(char *buf, int len);
251251
int register_commit_graft(struct commit_graft *, int);
252-
struct commit_graft *lookup_commit_graft(const unsigned char *sha1);
252+
struct commit_graft *lookup_commit_graft(const struct object_id *oid);
253253

254254
extern struct commit_list *get_merge_bases(struct commit *rev1, struct commit *rev2);
255255
extern struct commit_list *get_merge_bases_many(struct commit *one, int n, struct commit **twos);

fsck.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ static int fsck_commit_buffer(struct commit *commit, const char *buffer,
736736
buffer += 41;
737737
parent_line_count++;
738738
}
739-
graft = lookup_commit_graft(commit->object.oid.hash);
739+
graft = lookup_commit_graft(&commit->object.oid);
740740
parent_count = commit_list_count(commit->parents);
741741
if (graft) {
742742
if (graft->nr_parent == -1 && !parent_count)

shallow.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ struct commit_list *get_shallow_commits(struct object_array *heads, int depth,
107107
cur_depth++;
108108
if ((depth != INFINITE_DEPTH && cur_depth >= depth) ||
109109
(is_repository_shallow() && !commit->parents &&
110-
(graft = lookup_commit_graft(commit->object.oid.hash)) != NULL &&
110+
(graft = lookup_commit_graft(&commit->object.oid)) != NULL &&
111111
graft->nr_parent < 0)) {
112112
commit_list_insert(commit, &result);
113113
commit->object.flags |= shallow_flag;
@@ -398,7 +398,7 @@ void prepare_shallow_info(struct shallow_info *info, struct oid_array *sa)
398398
for (i = 0; i < sa->nr; i++) {
399399
if (has_object_file(sa->oid + i)) {
400400
struct commit_graft *graft;
401-
graft = lookup_commit_graft(sa->oid[i].hash);
401+
graft = lookup_commit_graft(&sa->oid[i]);
402402
if (graft && graft->nr_parent < 0)
403403
continue;
404404
info->ours[info->nr_ours++] = i;

0 commit comments

Comments
 (0)