Merge branch 'rs/wt-status-cleanup'
authorJunio C Hamano <gitster@pobox.com>
Wed, 12 Jul 2017 22:18:23 +0000 (15:18 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 12 Jul 2017 22:18:23 +0000 (15:18 -0700)
Code cleanup.

* rs/wt-status-cleanup:
  wt-status: use separate variable for result of shorten_unambiguous_ref

wt-status.c

index 8d2fb35..77c27c5 100644 (file)
@@ -1763,6 +1763,7 @@ static void wt_shortstatus_print_tracking(struct wt_status *s)
        const char *branch_color_remote = color(WT_STATUS_REMOTE_BRANCH, s);
 
        const char *base;
+       char *short_base;
        const char *branch_name;
        int num_ours, num_theirs;
        int upstream_is_gone = 0;
@@ -1797,10 +1798,10 @@ static void wt_shortstatus_print_tracking(struct wt_status *s)
                upstream_is_gone = 1;
        }
 
-       base = shorten_unambiguous_ref(base, 0);
+       short_base = shorten_unambiguous_ref(base, 0);
        color_fprintf(s->fp, header_color, "...");
-       color_fprintf(s->fp, branch_color_remote, "%s", base);
-       free((char *)base);
+       color_fprintf(s->fp, branch_color_remote, "%s", short_base);
+       free(short_base);
 
        if (!upstream_is_gone && !num_ours && !num_theirs)
                goto conclude;