Teach runstatus about --untracked
Actually, teach runstatus what to do if it is not passed; it should not list the contents of completely untracked directories, but only the name of that directory (plus a trailing '/'). [jc: with comments by Jeff King to match hide-empty-directories behaviour of the original.] Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
Johannes Schindelin committed
Sep 12, 2006 at 22:45 UTC
2074cb0af339f586cab6e0cdc20c4eadf3ba93e8
4 files changed
+10
-1
builtin-runstatus.c
+2
@@ -25,6 +25,8 @@ int cmd_runstatus(int argc, const char **argv, const char *prefix)
25
}
26
else if (!strcmp(argv[i], "--verbose"))
27
s.verbose = 1;
28
+ else if (!strcmp(argv[i], "--untracked"))
29
+ s.untracked = 1;
30
else
31
usage(runstatus_usage);
32
}
git-commit.sh
+2
-1
@@ -82,7 +82,8 @@ run_status () {
82
esac
83
git-runstatus ${color} \
84
${verbose:+--verbose} \
85
- ${amend:+--amend}
85
+ ${amend:+--amend} \
86
+ ${untracked_files:+--untracked}
87
}
88
89
trap '
wt-status.c
+5
@@ -50,6 +50,7 @@ void wt_status_prepare(struct wt_status *s)
50
s->amend = 0;
51
s->verbose = 0;
52
s->commitable = 0;
53
+ s->untracked = 0;
54
}
55
56
static void wt_status_print_header(const char *main, const char *sub)
@@ -188,6 +189,10 @@ static void wt_status_print_untracked(const struct wt_status *s)
189
memset(&dir, 0, sizeof(dir));
190
191
dir.exclude_per_dir = ".gitignore";
192
+ if (!s->untracked) {
193
+ dir.show_other_directories = 1;
194
+ dir.hide_empty_directories = 1;
195
+ }
196
x = git_path("info/exclude");
197
if (file_exists(x))
198
add_excludes_from_file(&dir, x);
wt-status.h
+1
@@ -15,6 +15,7 @@ struct wt_status {
15
int commitable;
16
int verbose;
17
int amend;
18
+ int untracked;
19
};
20
21
int git_status_config(const char *var, const char *value);