diff options
author | Derrick Stolee <dstolee@microsoft.com> | 2018-06-27 09:24:44 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-06-27 10:29:10 -0700 |
commit | d88b14b3fd691fc71c3cea5bc5bde9dd10b5e86c (patch) | |
tree | c7cf99ce8bc275e85ce642f3884c48f9c471f81f /commit-graph.c | |
parent | e0fd51e1d7d3877d4b0b4133c763d46b65d46f7a (diff) | |
download | git-d88b14b3fd691fc71c3cea5bc5bde9dd10b5e86c.tar.gz |
commit-graph: use string-list API for input
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit-graph.c')
-rw-r--r-- | commit-graph.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/commit-graph.c b/commit-graph.c index aca9e5e2dc..5b7fa707a5 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -657,10 +657,8 @@ static void compute_generation_numbers(struct packed_commit_list* commits) } void write_commit_graph(const char *obj_dir, - const char **pack_indexes, - int nr_packs, - const char **commit_hex, - int nr_commits, + struct string_list *pack_indexes, + struct string_list *commit_hex, int append) { struct packed_oid_list oids; @@ -701,10 +699,10 @@ void write_commit_graph(const char *obj_dir, int dirlen; strbuf_addf(&packname, "%s/pack/", obj_dir); dirlen = packname.len; - for (i = 0; i < nr_packs; i++) { + for (i = 0; i < pack_indexes->nr; i++) { struct packed_git *p; strbuf_setlen(&packname, dirlen); - strbuf_addstr(&packname, pack_indexes[i]); + strbuf_addstr(&packname, pack_indexes->items[i].string); p = add_packed_git(packname.buf, packname.len, 1); if (!p) die("error adding pack %s", packname.buf); @@ -717,12 +715,13 @@ void write_commit_graph(const char *obj_dir, } if (commit_hex) { - for (i = 0; i < nr_commits; i++) { + for (i = 0; i < commit_hex->nr; i++) { const char *end; struct object_id oid; struct commit *result; - if (commit_hex[i] && parse_oid_hex(commit_hex[i], &oid, &end)) + if (commit_hex->items[i].string && + parse_oid_hex(commit_hex->items[i].string, &oid, &end)) continue; result = lookup_commit_reference_gently(&oid, 1); |