summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-05-08 06:59:31 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-05-08 06:59:31 (GMT)
commit0cd58d8ba9aa562dd3c039af9565f61a14da03b8 (patch)
treeceae968fea74c4bc814d4fb4242ce88c369195ce /builtin
parent0657e0f802b0e0a97738c074dd27ee47eeb3366f (diff)
parent0b5e2ea7cf3b0fd0f4339b7c8b69cb8c5853c0cd (diff)
downloadgit-0cd58d8ba9aa562dd3c039af9565f61a14da03b8.zip
git-0cd58d8ba9aa562dd3c039af9565f61a14da03b8.tar.gz
git-0cd58d8ba9aa562dd3c039af9565f61a14da03b8.tar.bz2
Merge branch 'nd/submodule-status-fix'
"git submodule status" did not check the symbolic revision name it computed for the submodule HEAD is not the NULL, and threw it at printf routines, which has been corrected. * nd/submodule-status-fix: submodule--helper: don't print null in 'submodule status'
Diffstat (limited to 'builtin')
-rw-r--r--builtin/submodule--helper.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 7586f77..c2403a9 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -596,8 +596,12 @@ static void print_status(unsigned int flags, char state, const char *path,
printf("%c%s %s", state, oid_to_hex(oid), displaypath);
- if (state == ' ' || state == '+')
- printf(" (%s)", compute_rev_name(path, oid_to_hex(oid)));
+ if (state == ' ' || state == '+') {
+ const char *name = compute_rev_name(path, oid_to_hex(oid));
+
+ if (name)
+ printf(" (%s)", name);
+ }
printf("\n");
}