t5702: use test_commit_bulk
[gitweb.git] / wt-status.c
index 1dbb4d949cbd44139409b944373d221dc540a656..0bccef542fccee5deaa6ee3c740f60879aa97fb3 100644 (file)
@@ -749,12 +749,23 @@ static int has_unmerged(struct wt_status *s)
 
 void wt_status_collect(struct wt_status *s)
 {
+       trace2_region_enter("status", "worktrees", s->repo);
        wt_status_collect_changes_worktree(s);
-       if (s->is_initial)
+       trace2_region_leave("status", "worktrees", s->repo);
+
+       if (s->is_initial) {
+               trace2_region_enter("status", "initial", s->repo);
                wt_status_collect_changes_initial(s);
-       else
+               trace2_region_leave("status", "initial", s->repo);
+       } else {
+               trace2_region_enter("status", "index", s->repo);
                wt_status_collect_changes_index(s);
+               trace2_region_leave("status", "index", s->repo);
+       }
+
+       trace2_region_enter("status", "untracked", s->repo);
        wt_status_collect_untracked(s);
+       trace2_region_leave("status", "untracked", s->repo);
 
        wt_status_get_state(s->repo, &s->state, s->branch && !strcmp(s->branch, "HEAD"));
        if (s->state.merge_in_progress && !has_unmerged(s))
@@ -996,13 +1007,19 @@ size_t wt_status_locate_end(const char *s, size_t len)
        return len;
 }
 
-void wt_status_add_cut_line(FILE *fp)
+void wt_status_append_cut_line(struct strbuf *buf)
 {
        const char *explanation = _("Do not modify or remove the line above.\nEverything below it will be ignored.");
+
+       strbuf_commented_addf(buf, "%s", cut_line);
+       strbuf_add_commented_lines(buf, explanation, strlen(explanation));
+}
+
+void wt_status_add_cut_line(FILE *fp)
+{
        struct strbuf buf = STRBUF_INIT;
 
-       fprintf(fp, "%c %s", comment_line_char, cut_line);
-       strbuf_add_commented_lines(&buf, explanation, strlen(explanation));
+       wt_status_append_cut_line(&buf);
        fputs(buf.buf, fp);
        strbuf_release(&buf);
 }
@@ -1198,7 +1215,9 @@ static void abbrev_sha1_in_line(struct strbuf *line)
        int i;
 
        if (starts_with(line->buf, "exec ") ||
-           starts_with(line->buf, "x "))
+           starts_with(line->buf, "x ") ||
+           starts_with(line->buf, "label ") ||
+           starts_with(line->buf, "l "))
                return;
 
        split = strbuf_split_max(line, ' ', 3);
@@ -1869,7 +1888,7 @@ static void wt_shortstatus_print_tracking(struct wt_status *s)
        color_fprintf(s->fp, branch_color_local, "%s", branch_name);
 
        sti = stat_tracking_info(branch, &num_ours, &num_theirs, &base,
-                                s->ahead_behind_flags);
+                                0, s->ahead_behind_flags);
        if (sti < 0) {
                if (!base)
                        goto conclude;
@@ -2008,7 +2027,7 @@ static void wt_porcelain_v2_print_tracking(struct wt_status *s)
                branch = branch_get(branch_name);
                base = NULL;
                ab_info = stat_tracking_info(branch, &nr_ahead, &nr_behind,
-                                            &base, s->ahead_behind_flags);
+                                            &base, 0, s->ahead_behind_flags);
                if (base) {
                        base = shorten_unambiguous_ref(base, 0);
                        fprintf(s->fp, "# branch.upstream %s%c", base, eol);
@@ -2057,9 +2076,7 @@ static void wt_porcelain_v2_submodule_state(
 /*
  * Fix-up changed entries before we print them.
  */
-static void wt_porcelain_v2_fix_up_changed(
-       struct string_list_item *it,
-       struct wt_status *s)
+static void wt_porcelain_v2_fix_up_changed(struct string_list_item *it)
 {
        struct wt_status_change_data *d = it->util;
 
@@ -2119,7 +2136,7 @@ static void wt_porcelain_v2_print_changed_entry(
        char submodule_token[5];
        char sep_char, eol_char;
 
-       wt_porcelain_v2_fix_up_changed(it, s);
+       wt_porcelain_v2_fix_up_changed(it);
        wt_porcelain_v2_submodule_state(d, submodule_token);
 
        key[0] = d->index_status ? d->index_status : '.';
@@ -2320,6 +2337,13 @@ static void wt_porcelain_v2_print(struct wt_status *s)
 
 void wt_status_print(struct wt_status *s)
 {
+       trace2_data_intmax("status", s->repo, "count/changed", s->change.nr);
+       trace2_data_intmax("status", s->repo, "count/untracked",
+                          s->untracked.nr);
+       trace2_data_intmax("status", s->repo, "count/ignored", s->ignored.nr);
+
+       trace2_region_enter("status", "print", s->repo);
+
        switch (s->status_format) {
        case STATUS_FORMAT_SHORT:
                wt_shortstatus_print(s);
@@ -2338,6 +2362,8 @@ void wt_status_print(struct wt_status *s)
                wt_longstatus_print(s);
                break;
        }
+
+       trace2_region_leave("status", "print", s->repo);
 }
 
 /**