summaryrefslogtreecommitdiff
path: root/pretty.c
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2018-03-12 02:27:28 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-03-14 16:23:48 (GMT)
commit30e677e0e243ebb29a5f5aeed8c850bbae9020fa (patch)
treea974611a14bd9f2b0b74116bfe96fc362762f196 /pretty.c
parent1776979573fa150cfad850f73ab4109d245ad210 (diff)
downloadgit-30e677e0e243ebb29a5f5aeed8c850bbae9020fa.zip
git-30e677e0e243ebb29a5f5aeed8c850bbae9020fa.tar.gz
git-30e677e0e243ebb29a5f5aeed8c850bbae9020fa.tar.bz2
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 <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pretty.c')
-rw-r--r--pretty.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/pretty.c b/pretty.c
index f7ce490..34fe891 100644
--- a/pretty.c
+++ b/pretty.c
@@ -549,7 +549,7 @@ static void add_merge_info(const struct pretty_print_context *pp,
struct object_id *oidp = &parent->item->object.oid;
strbuf_addch(sb, ' ');
if (pp->abbrev)
- strbuf_add_unique_abbrev(sb, oidp->hash, pp->abbrev);
+ strbuf_add_unique_abbrev(sb, oidp, pp->abbrev);
else
strbuf_addstr(sb, oid_to_hex(oidp));
parent = parent->next;
@@ -1156,7 +1156,7 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
return 1;
case 'h': /* abbreviated commit hash */
strbuf_addstr(sb, diff_get_color(c->auto_color, DIFF_COMMIT));
- strbuf_add_unique_abbrev(sb, commit->object.oid.hash,
+ strbuf_add_unique_abbrev(sb, &commit->object.oid,
c->pretty_ctx->abbrev);
strbuf_addstr(sb, diff_get_color(c->auto_color, DIFF_RESET));
return 1;
@@ -1164,7 +1164,7 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
strbuf_addstr(sb, oid_to_hex(&commit->tree->object.oid));
return 1;
case 't': /* abbreviated tree hash */
- strbuf_add_unique_abbrev(sb, commit->tree->object.oid.hash,
+ strbuf_add_unique_abbrev(sb, &commit->tree->object.oid,
c->pretty_ctx->abbrev);
return 1;
case 'P': /* parent hashes */
@@ -1178,7 +1178,7 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
for (p = commit->parents; p; p = p->next) {
if (p != commit->parents)
strbuf_addch(sb, ' ');
- strbuf_add_unique_abbrev(sb, p->item->object.oid.hash,
+ strbuf_add_unique_abbrev(sb, &p->item->object.oid,
c->pretty_ctx->abbrev);
}
return 1;