summaryrefslogtreecommitdiff
path: root/submodule.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-10-17 13:25:21 -0700
committerJunio C Hamano <gitster@pobox.com>2016-10-17 13:25:21 -0700
commit69e6544998892a2bd3c785cd238c786da40cf6a3 (patch)
tree5226289723f43db878429658b27a89b4ad23ee57 /submodule.c
parent9424bf27079a1262e42a2330283f7ab6c805267a (diff)
parenta94bb683970a111b467a36590ca36e52754ad504 (diff)
downloadgit-69e6544998892a2bd3c785cd238c786da40cf6a3.tar.gz
Merge branch 'rs/cocci'
Code cleanup. * rs/cocci: use strbuf_add_unique_abbrev() for adding short hashes, part 3 remove unnecessary NULL check before free(3)
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 733332035b..6f7d883de9 100644
--- a/submodule.c
+++ b/submodule.c
@@ -371,10 +371,9 @@ static void show_submodule_header(FILE *f, const char *path,
}
output_header:
- strbuf_addf(&sb, "%s%sSubmodule %s %s..", line_prefix, meta, path,
- find_unique_abbrev(one->hash, 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->hash, DEFAULT_ABBREV);
+ strbuf_addstr(&sb, (fast_backward || fast_forward) ? ".." : "...");
strbuf_add_unique_abbrev(&sb, two->hash, DEFAULT_ABBREV);
if (message)
strbuf_addf(&sb, " %s%s\n", message, reset);