]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'nd/submodule-status-fix'
authorJunio C Hamano <gitster@pobox.com>
Tue, 8 May 2018 06:59:31 +0000 (15:59 +0900)
committerJunio C Hamano <gitster@pobox.com>
Tue, 8 May 2018 06:59:31 +0000 (15:59 +0900)
"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'

builtin/submodule--helper.c

index 7586f776fe3cf2140c86f1f1842389f186929201..c2403a915ffe29e152832ae16e5bc902703a9903 100644 (file)
@@ -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");
 }