diff options
| author | Junio C Hamano <gitster@pobox.com> | 2026-02-20 10:09:32 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-02-20 10:09:32 -0800 |
| commit | 4fa8cfd68ab9ed6fb273a354ff1b5e240cbabc1d (patch) | |
| tree | 727bb838a214bbdda297fbe6125b270edc4169c5 /bisect.c | |
| parent | 73fd77805fc6406f31c36212846d9e2541d19321 (diff) | |
| parent | 6375a00ef16071eadbb383bd9915e277ef304bfe (diff) | |
| download | git-4fa8cfd68ab9ed6fb273a354ff1b5e240cbabc1d.tar.xz | |
Merge branch 'ps/for-each-ref-in-fixes' into ps/refs-for-each
* ps/for-each-ref-in-fixes:
bisect: simplify string_list memory handling
bisect: fix misuse of `refs_for_each_ref_in()`
pack-bitmap: fix bug with exact ref match in "pack.preferBitmapTips"
pack-bitmap: deduplicate logic to iterate over preferred bitmap tips
Diffstat (limited to 'bisect.c')
| -rw-r--r-- | bisect.c | 16 |
1 files changed, 7 insertions, 9 deletions
@@ -1180,8 +1180,7 @@ int estimate_bisect_steps(int all) static int mark_for_removal(const struct reference *ref, void *cb_data) { struct string_list *refs = cb_data; - char *bisect_ref = xstrfmt("refs/bisect%s", ref->name); - string_list_append(refs, bisect_ref); + string_list_append(refs, ref->name); return 0; } @@ -1190,16 +1189,15 @@ int bisect_clean_state(void) int result = 0; /* There may be some refs packed during bisection */ - struct string_list refs_for_removal = STRING_LIST_INIT_NODUP; - refs_for_each_ref_in(get_main_ref_store(the_repository), - "refs/bisect", mark_for_removal, - (void *) &refs_for_removal); - string_list_append(&refs_for_removal, xstrdup("BISECT_HEAD")); - string_list_append(&refs_for_removal, xstrdup("BISECT_EXPECTED_REV")); + struct string_list refs_for_removal = STRING_LIST_INIT_DUP; + refs_for_each_fullref_in(get_main_ref_store(the_repository), + "refs/bisect/", NULL, mark_for_removal, + &refs_for_removal); + string_list_append(&refs_for_removal, "BISECT_HEAD"); + string_list_append(&refs_for_removal, "BISECT_EXPECTED_REV"); result = refs_delete_refs(get_main_ref_store(the_repository), "bisect: remove", &refs_for_removal, REF_NO_DEREF); - refs_for_removal.strdup_strings = 1; string_list_clear(&refs_for_removal, 0); unlink_or_warn(git_path_bisect_ancestors_ok()); unlink_or_warn(git_path_bisect_log()); |
