aboutsummaryrefslogtreecommitdiff
path: root/object-file.h
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 /object-file.h
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 'object-file.h')
-rw-r--r--object-file.h21
1 files changed, 13 insertions, 8 deletions
diff --git a/object-file.h b/object-file.h
index f8d8805a18..3686f182e4 100644
--- a/object-file.h
+++ b/object-file.h
@@ -75,13 +75,6 @@ int odb_source_loose_write_stream(struct odb_source *source,
struct object_id *oid);
/*
- * Populate and return the loose object cache array corresponding to the
- * given object ID.
- */
-struct oidtree *odb_source_loose_cache(struct odb_source *source,
- const struct object_id *oid);
-
-/*
* Put in `buf` the name of the file in the local object database that
* would be used to store a loose object with the specified oid.
*/
@@ -137,7 +130,7 @@ int odb_source_loose_for_each_object(struct odb_source *source,
const struct object_info *request,
odb_for_each_object_cb cb,
void *cb_data,
- unsigned flags);
+ const struct odb_for_each_object_options *opts);
/*
* Count the number of loose objects in this source.
@@ -153,6 +146,18 @@ int odb_source_loose_count_objects(struct odb_source *source,
enum odb_count_objects_flags flags,
unsigned long *out);
+/*
+ * Find the shortest unique prefix for the given object ID, where `min_len` is
+ * the minimum length that the prefix should have.
+ *
+ * Returns 0 on success, in which case the computed length will be written to
+ * `out`. Otherwise, a negative error code is returned.
+ */
+int odb_source_loose_find_abbrev_len(struct odb_source *source,
+ const struct object_id *oid,
+ unsigned min_len,
+ unsigned *out);
+
/**
* format_object_header() is a thin wrapper around s xsnprintf() that
* writes the initial "<type> <obj-len>" part of the loose object