summaryrefslogtreecommitdiff
path: root/submodule.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2016-10-08 15:38:47 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-10-10 18:58:25 (GMT)
commita94bb683970a111b467a36590ca36e52754ad504 (patch)
treeafb36d917037d10a78c3a5c251f0430d3f4e1e5f /submodule.c
parent39ea59a2570547166834ceeff9ae0c0c05748f35 (diff)
downloadgit-a94bb683970a111b467a36590ca36e52754ad504.zip
git-a94bb683970a111b467a36590ca36e52754ad504.tar.gz
git-a94bb683970a111b467a36590ca36e52754ad504.tar.bz2
use strbuf_add_unique_abbrev() for adding short hashes, part 3
Call strbuf_add_unique_abbrev() to add abbreviated hashes to strbufs instead of taking detours through find_unique_abbrev() and its static buffer. This is shorter in most cases and a bit more efficient. The changes here are not easily handled by a semantic patch because they involve removing temporary variables and deconstructing format strings for strbuf_addf(). Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'submodule.c')
-rw-r--r--submodule.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/submodule.c b/submodule.c
index 1e28437..f2ba4a2 100644
--- a/submodule.c
+++ b/submodule.c
@@ -370,10 +370,9 @@ void show_submodule_summary(FILE *f, const char *path,
return;
}
- strbuf_addf(&sb, "%s%sSubmodule %s %s..", line_prefix, meta, path,
- find_unique_abbrev(one, DEFAULT_ABBREV));
- if (!fast_backward && !fast_forward)
- strbuf_addch(&sb, '.');
+ strbuf_addf(&sb, "%s%sSubmodule %s ", line_prefix, meta, path);
+ strbuf_add_unique_abbrev(&sb, one, DEFAULT_ABBREV);
+ strbuf_addstr(&sb, (fast_backward || fast_forward) ? ".." : "...");
strbuf_add_unique_abbrev(&sb, two, DEFAULT_ABBREV);
if (message)
strbuf_addf(&sb, " %s%s\n", message, reset);