aboutsummaryrefslogtreecommitdiff
path: root/t/unit-tests
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2026-04-06 15:42:48 -0700
committerJunio C Hamano <gitster@pobox.com>2026-04-06 15:42:49 -0700
commitd75badf83bc3fc8e47413970874bac681eeb5bbe (patch)
tree081e6d6ef91541664ae664acc0af7f8e7f943d01 /t/unit-tests
parent2f8c3f6a5a6d6a3de205be709e1a598b9d4b0b3e (diff)
parent83869e15fa9ef3b0ea2adbfe2fe68a309f95b856 (diff)
downloadgit-d75badf83bc3fc8e47413970874bac681eeb5bbe.tar.xz
Merge branch 'ps/odb-generic-object-name-handling'
Object name handling (disambiguation and abbreviation) has been refactored to be backend-generic, moving logic into the respective object database backends. * ps/odb-generic-object-name-handling: odb: introduce generic `odb_find_abbrev_len()` object-file: move logic to compute packed abbreviation length object-name: move logic to compute loose abbreviation length object-name: simplify computing common prefixes object-name: abbreviate loose object names without `disambiguate_state` object-name: merge `update_candidates()` and `match_prefix()` object-name: backend-generic `get_short_oid()` object-name: backend-generic `repo_collect_ambiguous()` object-name: extract function to parse object ID prefixes object-name: move logic to iterate through packed prefixed objects object-name: move logic to iterate through loose prefixed objects odb: introduce `struct odb_for_each_object_options` oidtree: extend iteration to allow for arbitrary return codes oidtree: modernize the code a bit object-file: fix sparse 'plain integer as NULL pointer' error
Diffstat (limited to 't/unit-tests')
-rw-r--r--t/unit-tests/u-oidtree.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/t/unit-tests/u-oidtree.c b/t/unit-tests/u-oidtree.c
index e6eede2740..d4d05c7dc3 100644
--- a/t/unit-tests/u-oidtree.c
+++ b/t/unit-tests/u-oidtree.c
@@ -24,7 +24,7 @@ static int fill_tree_loc(struct oidtree *ot, const char *hexes[], size_t n)
return 0;
}
-static void check_contains(struct oidtree *ot, const char *hex, int expected)
+static void check_contains(struct oidtree *ot, const char *hex, bool expected)
{
struct object_id oid;
@@ -38,7 +38,7 @@ struct expected_hex_iter {
const char *query;
};
-static enum cb_next check_each_cb(const struct object_id *oid, void *data)
+static int check_each_cb(const struct object_id *oid, void *data)
{
struct expected_hex_iter *hex_iter = data;
struct object_id expected;
@@ -49,7 +49,7 @@ static enum cb_next check_each_cb(const struct object_id *oid, void *data)
&expected);
cl_assert_equal_s(oid_to_hex(oid), oid_to_hex(&expected));
hex_iter->i += 1;
- return CB_CONTINUE;
+ return 0;
}
LAST_ARG_MUST_BE_NULL
@@ -88,12 +88,12 @@ void test_oidtree__cleanup(void)
void test_oidtree__contains(void)
{
FILL_TREE(&ot, "444", "1", "2", "3", "4", "5", "a", "b", "c", "d", "e");
- check_contains(&ot, "44", 0);
- check_contains(&ot, "441", 0);
- check_contains(&ot, "440", 0);
- check_contains(&ot, "444", 1);
- check_contains(&ot, "4440", 1);
- check_contains(&ot, "4444", 0);
+ check_contains(&ot, "44", false);
+ check_contains(&ot, "441", false);
+ check_contains(&ot, "440", false);
+ check_contains(&ot, "444", true);
+ check_contains(&ot, "4440", true);
+ check_contains(&ot, "4444", false);
}
void test_oidtree__each(void)