| 1930 | } |
| 1931 | |
| 1932 | static int fill_oids_from_packs(struct write_commit_graph_context *ctx, |
| 1933 | const struct string_list *pack_indexes) |
| 1934 | { |
| 1935 | uint32_t i; |
| 1936 | struct strbuf progress_title = STRBUF_INIT; |
| 1937 | struct strbuf packname = STRBUF_INIT; |
| 1938 | int dirlen; |
| 1939 | int ret = 0; |
| 1940 | |
| 1941 | strbuf_addf(&packname, "%s/pack/", ctx->odb_source->path); |
| 1942 | dirlen = packname.len; |
| 1943 | if (ctx->report_progress) { |
| 1944 | strbuf_addf(&progress_title, |
| 1945 | Q_("Finding commits for commit graph in %"PRIuMAX" pack", |
| 1946 | "Finding commits for commit graph in %"PRIuMAX" packs", |
| 1947 | pack_indexes->nr), |
| 1948 | (uintmax_t)pack_indexes->nr); |
| 1949 | ctx->progress = start_delayed_progress(ctx->r, |
| 1950 | progress_title.buf, 0); |
| 1951 | ctx->progress_done = 0; |
| 1952 | } |
| 1953 | for (i = 0; i < pack_indexes->nr; i++) { |
| 1954 | struct packed_git *p; |
| 1955 | strbuf_setlen(&packname, dirlen); |
| 1956 | strbuf_addstr(&packname, pack_indexes->items[i].string); |
| 1957 | p = add_packed_git(ctx->r, packname.buf, packname.len, 1); |
| 1958 | if (!p) { |
| 1959 | ret = error(_("error adding pack %s"), packname.buf); |
| 1960 | goto cleanup; |
| 1961 | } |
| 1962 | if (open_pack_index(p)) { |
| 1963 | ret = error(_("error opening index for %s"), packname.buf); |
| 1964 | close_pack(p); |
| 1965 | free(p); |
| 1966 | goto cleanup; |
| 1967 | } |
| 1968 | for_each_object_in_pack(p, add_packed_commits, ctx, |
| 1969 | ODB_FOR_EACH_OBJECT_PACK_ORDER); |
| 1970 | close_pack(p); |
| 1971 | free(p); |
| 1972 | } |
| 1973 | |
| 1974 | cleanup: |
| 1975 | stop_progress(&ctx->progress); |
| 1976 | strbuf_release(&progress_title); |
| 1977 | strbuf_release(&packname); |
| 1978 | |
| 1979 | return ret; |
| 1980 | } |
| 1981 | |
| 1982 | static int fill_oids_from_commits(struct write_commit_graph_context *ctx, |
| 1983 | struct oidset *commits) |
no test coverage detected