131
{
132
const char *c = color(WT_STATUS_HEADER, s);
133
134
- color_fprintf_ln(s->fp, c, "# Unmerged paths:");
134
+ status_printf_ln(s, c, "Unmerged paths:");
135
if (!advice_status_hints)
136
return;
137
if (s->in_merge)
138
;
139
else if (!s->is_initial)
140
- color_fprintf_ln(s->fp, c, "# (use \"git reset %s <file>...\" to unstage)", s->reference);
140
+ status_printf_ln(s, c, " (use \"git reset %s <file>...\" to unstage)", s->reference);
141
else
142
- color_fprintf_ln(s->fp, c, "# (use \"git rm --cached <file>...\" to unstage)");
143
- color_fprintf_ln(s->fp, c, "# (use \"git add/rm <file>...\" as appropriate to mark resolution)");
144
- color_fprintf_ln(s->fp, c, "#");
142
+ status_printf_ln(s, c, " (use \"git rm --cached <file>...\" to unstage)");
143
+ status_printf_ln(s, c, " (use \"git add/rm <file>...\" as appropriate to mark resolution)");
144
+ status_printf_ln(s, c, "");
145
}
146
147
static void wt_status_print_cached_header(struct wt_status *s)
148
{
149
const char *c = color(WT_STATUS_HEADER, s);
150
151
- color_fprintf_ln(s->fp, c, "# Changes to be committed:");
151
+ status_printf_ln(s, c, "Changes to be committed:");
152
if (!advice_status_hints)
153
return;
154
if (s->in_merge)
155
; /* NEEDSWORK: use "git reset --unresolve"??? */
156
else if (!s->is_initial)
157
- color_fprintf_ln(s->fp, c, "# (use \"git reset %s <file>...\" to unstage)", s->reference);
157
+ status_printf_ln(s, c, " (use \"git reset %s <file>...\" to unstage)", s->reference);
158
else
159
- color_fprintf_ln(s->fp, c, "# (use \"git rm --cached <file>...\" to unstage)");
160
- color_fprintf_ln(s->fp, c, "#");
159
+ status_printf_ln(s, c, " (use \"git rm --cached <file>...\" to unstage)");
160
+ status_printf_ln(s, c, "");
161
}
162
163
static void wt_status_print_dirty_header(struct wt_status *s,
166
{
167
const char *c = color(WT_STATUS_HEADER, s);
168
169
- color_fprintf_ln(s->fp, c, "# Changes not staged for commit:");
169
+ status_printf_ln(s, c, "Changes not staged for commit:");
170
if (!advice_status_hints)
171
return;
172
if (!has_deleted)
173
- color_fprintf_ln(s->fp, c, "# (use \"git add <file>...\" to update what will be committed)");
173
+ status_printf_ln(s, c, " (use \"git add <file>...\" to update what will be committed)");
174
else
175
- color_fprintf_ln(s->fp, c, "# (use \"git add/rm <file>...\" to update what will be committed)");
176
- color_fprintf_ln(s->fp, c, "# (use \"git checkout -- <file>...\" to discard changes in working directory)");
175
+ status_printf_ln(s, c, " (use \"git add/rm <file>...\" to update what will be committed)");
176
+ status_printf_ln(s, c, " (use \"git checkout -- <file>...\" to discard changes in working directory)");
177
if (has_dirty_submodules)
178
- color_fprintf_ln(s->fp, c, "# (commit or discard the untracked or modified content in submodules)");
179
- color_fprintf_ln(s->fp, c, "#");
178
+ status_printf_ln(s, c, " (commit or discard the untracked or modified content in submodules)");
179
+ status_printf_ln(s, c, "");
180
}
181
182
static void wt_status_print_other_header(struct wt_status *s,
184
const char *how)
185
{
186
const char *c = color(WT_STATUS_HEADER, s);
187
- color_fprintf_ln(s->fp, c, "# %s files:", what);
187
+ status_printf_ln(s, c, "%s files:", what);
188
if (!advice_status_hints)
189
return;
190
- color_fprintf_ln(s->fp, c, "# (use \"git %s <file>...\" to include in what will be committed)", how);
191
- color_fprintf_ln(s->fp, c, "#");
190
+ status_printf_ln(s, c, " (use \"git %s <file>...\" to include in what will be committed)", how);
191
+ status_printf_ln(s, c, "");
192
}
193
194
static void wt_status_print_trailer(struct wt_status *s)
195
{
196
- color_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s), "#");
196
+ status_printf_ln(s, color(WT_STATUS_HEADER, s), "");
197
}
198
199
#define quote_path quote_path_relative
207
const char *one, *how = "bug";
208
209
one = quote_path(it->string, -1, &onebuf, s->prefix);
210
- color_fprintf(s->fp, color(WT_STATUS_HEADER, s), "#\t");
210
+ status_printf(s, color(WT_STATUS_HEADER, s), "\t");
211
switch (d->stagemask) {
212
case 1: how = "both deleted:"; break;
213
case 2: how = "added by us:"; break;
217
case 6: how = "both added:"; break;
218
case 7: how = "both modified:"; break;
219
}
220
- color_fprintf(s->fp, c, "%-20s%s\n", how, one);
220
+ status_printf_more(s, c, "%-20s%s\n", how, one);
221
strbuf_release(&onebuf);
222
}
223
260
one = quote_path(one_name, -1, &onebuf, s->prefix);
261
two = quote_path(two_name, -1, &twobuf, s->prefix);
262
263
- color_fprintf(s->fp, color(WT_STATUS_HEADER, s), "#\t");
263
+ status_printf(s, color(WT_STATUS_HEADER, s), "\t");
264
switch (status) {
265
case DIFF_STATUS_ADDED:
266
- color_fprintf(s->fp, c, "new file: %s", one);
266
+ status_printf_more(s, c, "new file: %s", one);
267
break;
268
case DIFF_STATUS_COPIED:
269
- color_fprintf(s->fp, c, "copied: %s -> %s", one, two);
269
+ status_printf_more(s, c, "copied: %s -> %s", one, two);
270
break;
271
case DIFF_STATUS_DELETED:
272
- color_fprintf(s->fp, c, "deleted: %s", one);
272
+ status_printf_more(s, c, "deleted: %s", one);
273
break;
274
case DIFF_STATUS_MODIFIED:
275
- color_fprintf(s->fp, c, "modified: %s", one);
275
+ status_printf_more(s, c, "modified: %s", one);
276
break;
277
case DIFF_STATUS_RENAMED:
278
- color_fprintf(s->fp, c, "renamed: %s -> %s", one, two);
278
+ status_printf_more(s, c, "renamed: %s -> %s", one, two);
279
break;
280
case DIFF_STATUS_TYPE_CHANGED:
281
- color_fprintf(s->fp, c, "typechange: %s", one);
281
+ status_printf_more(s, c, "typechange: %s", one);
282
break;
283
case DIFF_STATUS_UNKNOWN:
284
- color_fprintf(s->fp, c, "unknown: %s", one);
284
+ status_printf_more(s, c, "unknown: %s", one);
285
break;
286
case DIFF_STATUS_UNMERGED:
287
- color_fprintf(s->fp, c, "unmerged: %s", one);
287
+ status_printf_more(s, c, "unmerged: %s", one);
288
break;
289
default:
290
die("bug: unhandled diff status %c", status);
291
}
292
if (extra.len) {
293
- color_fprintf(s->fp, color(WT_STATUS_HEADER, s), "%s", extra.buf);
293
+ status_printf_more(s, color(WT_STATUS_HEADER, s), "%s", extra.buf);
294
strbuf_release(&extra);
295
}
296
- fprintf(s->fp, "\n");
296
+ status_printf_more(s, GIT_COLOR_NORMAL, "\n");
297
strbuf_release(&onebuf);
298
strbuf_release(&twobuf);
299
}
647
for (i = 0; i < l->nr; i++) {
648
struct string_list_item *it;
649
it = &(l->items[i]);
650
- color_fprintf(s->fp, color(WT_STATUS_HEADER, s), "#\t");
651
- color_fprintf_ln(s->fp, color(WT_STATUS_UNTRACKED, s), "%s",
652
- quote_path(it->string, strlen(it->string),
650
+ status_printf(s, color(WT_STATUS_HEADER, s), "\t");
651
+ status_printf_more(s, color(WT_STATUS_UNTRACKED, s),
652
+ "%s\n", quote_path(it->string, strlen(it->string),
653
&buf, s->prefix));
654
}
655
strbuf_release(&buf);
716
branch_status_color = color(WT_STATUS_NOBRANCH, s);
717
on_what = "Not currently on any branch.";
718
}
719
- color_fprintf(s->fp, color(WT_STATUS_HEADER, s), "# ");
720
- color_fprintf(s->fp, branch_status_color, "%s", on_what);
721
- color_fprintf_ln(s->fp, branch_color, "%s", branch_name);
719
+ status_printf(s, color(WT_STATUS_HEADER, s), "");
720
+ status_printf_more(s, branch_status_color, "%s", on_what);
721
+ status_printf_more(s, branch_color, "%s\n", branch_name);
722
if (!s->is_initial)
723
wt_status_print_tracking(s);
724
}
725
726
if (s->is_initial) {
727
- color_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s), "#");
728
- color_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s), "# Initial commit");
729
- color_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s), "#");
727
+ status_printf_ln(s, color(WT_STATUS_HEADER, s), "");
728
+ status_printf_ln(s, color(WT_STATUS_HEADER, s), "Initial commit");
729
+ status_printf_ln(s, color(WT_STATUS_HEADER, s), "");
730
}
731
732
wt_status_print_updated(s);
743
if (s->show_ignored_files)
744
wt_status_print_other(s, &s->ignored, "Ignored", "add -f");
745
} else if (s->commitable)
746
- fprintf(s->fp, "# Untracked files not listed%s\n",
746
+ status_printf_ln(s, GIT_COLOR_NORMAL, "Untracked files not listed%s",
747
advice_status_hints
748
? " (use -u option to show untracked files)" : "");
749
751
wt_status_print_verbose(s);
752
if (!s->commitable) {
753
if (s->amend)
754
- fprintf(s->fp, "# No changes\n");
754
+ status_printf_ln(s, GIT_COLOR_NORMAL, "No changes");
755
else if (s->nowarn)
756
; /* nothing */
757
else if (s->workdir_dirty)