Code

Merge branch 'jc/request-pull-show-head-4'
[git.git] / wt-status.c
index 8836a527d0b1980bd4ebdd50b3225f7ce37ccf79..9ffc535f1ab0296fd0a3330b1f136d69f9ac9bb2 100644 (file)
@@ -111,7 +111,6 @@ void status_printf_more(struct wt_status *s, const char *color,
 void wt_status_prepare(struct wt_status *s)
 {
        unsigned char sha1[20];
-       const char *head;
 
        memset(s, 0, sizeof(*s));
        memcpy(s->color_palette, default_wt_status_colors,
@@ -119,8 +118,7 @@ void wt_status_prepare(struct wt_status *s)
        s->show_untracked_files = SHOW_NORMAL_UNTRACKED_FILES;
        s->use_color = -1;
        s->relative_paths = 1;
-       head = resolve_ref("HEAD", sha1, 0, NULL);
-       s->branch = head ? xstrdup(head) : NULL;
+       s->branch = resolve_refdup("HEAD", sha1, 0, NULL);
        s->reference = "HEAD";
        s->fp = stdout;
        s->index_file = get_index_file();
@@ -396,7 +394,7 @@ static void wt_status_collect_changes_worktree(struct wt_status *s)
        if (s->ignore_submodule_arg) {
                DIFF_OPT_SET(&rev.diffopt, OVERRIDE_SUBMODULE_CONFIG);
                handle_ignore_submodules_arg(&rev.diffopt, s->ignore_submodule_arg);
-    }
+       }
        rev.diffopt.format_callback = wt_status_collect_changed_cb;
        rev.diffopt.format_callback_data = s;
        init_pathspec(&rev.prune_data, s->pathspec);