From 30e677e0e243ebb29a5f5aeed8c850bbae9020fa Mon Sep 17 00:00:00 2001 From: "brian m. carlson" Date: Mon, 12 Mar 2018 02:27:28 +0000 Subject: strbuf: convert strbuf_add_unique_abbrev to use struct object_id Convert the declaration and definition of strbuf_add_unique_abbrev to make it take a pointer to struct object_id. Predeclare the struct in strbuf.h, as cache.h includes strbuf.h before it declares the struct, and otherwise the struct declaration would have the wrong scope. Apply the following semantic patch, along with the standard object_id transforms, to adjust the callers: @@ expression E1, E2, E3; @@ - strbuf_add_unique_abbrev(E1, E2.hash, E3); + strbuf_add_unique_abbrev(E1, &E2, E3); @@ expression E1, E2, E3; @@ - strbuf_add_unique_abbrev(E1, E2->hash, E3); + strbuf_add_unique_abbrev(E1, E2, E3); Signed-off-by: brian m. carlson Signed-off-by: Junio C Hamano --- strbuf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'strbuf.c') diff --git a/strbuf.c b/strbuf.c index 5f138ed3c..07309045e 100644 --- a/strbuf.c +++ b/strbuf.c @@ -873,12 +873,12 @@ void strbuf_addftime(struct strbuf *sb, const char *fmt, const struct tm *tm, strbuf_setlen(sb, sb->len + len); } -void strbuf_add_unique_abbrev(struct strbuf *sb, const unsigned char *sha1, +void strbuf_add_unique_abbrev(struct strbuf *sb, const struct object_id *oid, int abbrev_len) { int r; strbuf_grow(sb, GIT_SHA1_HEXSZ + 1); - r = find_unique_abbrev_r(sb->buf + sb->len, sha1, abbrev_len); + r = find_unique_abbrev_r(sb->buf + sb->len, oid->hash, abbrev_len); strbuf_setlen(sb, sb->len + r); } -- cgit v1.2.3