Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-07-06 21:54:46 +0300
committerJunio C Hamano <gitster@pobox.com>2023-07-06 21:54:46 +0300
commit67e7305e64fea8d15879e9dc3831fc8e31cfe619 (patch)
treed8ed9ee0a2b54f3df4619af5757d938bb5247986 /object-name.c
parentda269af9207e38e820daad8aa993caa7d2fad76c (diff)
parent787cb8a48ae24ff07fa7c763909bb204bfdc84a7 (diff)
Merge branch 'cw/strbuf-cleanup'
Move functions that are not about pure string manipulation out of strbuf.[ch] * cw/strbuf-cleanup: strbuf: remove global variable path: move related function to path object-name: move related functions to object-name credential-store: move related functions to credential-store file abspath: move related functions to abspath strbuf: clarify dependency strbuf: clarify API boundary
Diffstat (limited to 'object-name.c')
-rw-r--r--object-name.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/object-name.c b/object-name.c
index 7e96c97051..0bfa29dbbf 100644
--- a/object-name.c
+++ b/object-name.c
@@ -769,6 +769,21 @@ static void find_abbrev_len_packed(struct min_abbrev_data *mad)
find_abbrev_len_for_pack(p, mad);
}
+void strbuf_repo_add_unique_abbrev(struct strbuf *sb, struct repository *repo,
+ const struct object_id *oid, int abbrev_len)
+{
+ int r;
+ strbuf_grow(sb, GIT_MAX_HEXSZ + 1);
+ r = repo_find_unique_abbrev_r(repo, sb->buf + sb->len, oid, abbrev_len);
+ strbuf_setlen(sb, sb->len + r);
+}
+
+void strbuf_add_unique_abbrev(struct strbuf *sb, const struct object_id *oid,
+ int abbrev_len)
+{
+ strbuf_repo_add_unique_abbrev(sb, the_repository, oid, abbrev_len);
+}
+
int repo_find_unique_abbrev_r(struct repository *r, char *hex,
const struct object_id *oid, int len)
{