Teach runstatus about --untracked
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>
Tue, 12 Sep 2006 20:45:12 +0000 (22:45 +0200)
committerJunio C Hamano <junkio@cox.net>
Wed, 13 Sep 2006 06:20:17 +0000 (23:20 -0700)
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>
builtin-runstatus.c
git-commit.sh
wt-status.c
wt-status.h

index 7979d61..303c556 100644 (file)
@@ -25,6 +25,8 @@ int cmd_runstatus(int argc, const char **argv, const char *prefix)
                }
                else if (!strcmp(argv[i], "--verbose"))
                        s.verbose = 1;
+               else if (!strcmp(argv[i], "--untracked"))
+                       s.untracked = 1;
                else
                        usage(runstatus_usage);
        }
index 10c269a..5a4c659 100755 (executable)
@@ -82,7 +82,8 @@ run_status () {
   esac
   git-runstatus ${color} \
                 ${verbose:+--verbose} \
-                ${amend:+--amend}
+                ${amend:+--amend} \
+               ${untracked_files:+--untracked}
 }
 
 trap '
index ec2c728..c644331 100644 (file)
@@ -50,6 +50,7 @@ void wt_status_prepare(struct wt_status *s)
        s->amend = 0;
        s->verbose = 0;
        s->commitable = 0;
+       s->untracked = 0;
 }
 
 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)
        memset(&dir, 0, sizeof(dir));
 
        dir.exclude_per_dir = ".gitignore";
+       if (!s->untracked) {
+               dir.show_other_directories = 1;
+               dir.hide_empty_directories = 1;
+       }
        x = git_path("info/exclude");
        if (file_exists(x))
                add_excludes_from_file(&dir, x);
index 75d3cfe..0a5a5b7 100644 (file)
@@ -15,6 +15,7 @@ struct wt_status {
        int commitable;
        int verbose;
        int amend;
+       int untracked;
 };
 
 int git_status_config(const char *var, const char *value);