#include "diffcore.h"
#include "quote.h"
#include "run-command.h"
+#include "remote.h"
int wt_status_relative_paths = 1;
int wt_status_use_color = -1;
read_directory(&dir, ".", "", 0, NULL);
for(i = 0; i < dir.nr; i++) {
- /* check for matching entry, which is unmerged; lifted from
- * builtin-ls-files:show_other_files */
struct dir_entry *ent = dir.entries[i];
- int pos = cache_name_pos(ent->name, ent->len);
- struct cache_entry *ce;
- if (0 <= pos)
- die("bug in wt_status_print_untracked");
- pos = -pos - 1;
- if (pos < active_nr) {
- ce = active_cache[pos];
- if (ce_namelen(ce) == ent->len &&
- !memcmp(ce->name, ent->name, ent->len))
- continue;
- }
+ if (!cache_name_is_other(ent->name, ent->len))
+ continue;
if (!shown_header) {
s->workdir_untracked = 1;
wt_status_print_header(s, "Untracked files",
run_diff_index(&rev, 1);
}
+static void wt_status_print_tracking(struct wt_status *s)
+{
+ struct strbuf sb = STRBUF_INIT;
+ const char *cp, *ep;
+ struct branch *branch;
+
+ assert(s->branch && !s->is_initial);
+ if (prefixcmp(s->branch, "refs/heads/"))
+ return;
+ branch = branch_get(s->branch + 11);
+ if (!format_tracking_info(branch, &sb))
+ return;
+
+ for (cp = sb.buf; (ep = strchr(cp, '\n')) != NULL; cp = ep + 1)
+ color_fprintf_ln(s->fp, color(WT_STATUS_HEADER),
+ "# %.*s", (int)(ep - cp), cp);
+ color_fprintf_ln(s->fp, color(WT_STATUS_HEADER), "#");
+}
+
void wt_status_print(struct wt_status *s)
{
unsigned char sha1[20];
}
color_fprintf(s->fp, color(WT_STATUS_HEADER), "# ");
color_fprintf_ln(s->fp, branch_color, "%s%s", on_what, branch_name);
+ if (!s->is_initial)
+ wt_status_print_tracking(s);
}
if (s->is_initial) {
}
if (!strcmp(k, "status.showuntrackedfiles")) {
if (!v)
- return config_error_nonbool(v);
+ return config_error_nonbool(k);
else if (!strcmp(v, "no"))
show_untracked_files = SHOW_NO_UNTRACKED_FILES;
else if (!strcmp(v, "normal"))