shortlog: default to HEAD when the standard input is a tty
[git/peff.git] / builtin-runstatus.c
blob8d167a9674e70a36662528c98165bd3be8a9f431
1 #include "builtin.h"
2 #include "cache.h"
3 #include "wt-status.h"
5 extern int wt_status_use_color;
7 static const char runstatus_usage[] =
8 "git-runstatus [--color|--nocolor] [--amend] [--verbose] [--untracked]";
10 int cmd_runstatus(int argc, const char **argv, const char *prefix)
12 struct wt_status s;
13 int i;
15 git_config(git_status_config);
16 wt_status_prepare(&s);
17 s.prefix = prefix;
19 for (i = 1; i < argc; i++) {
20 if (!strcmp(argv[i], "--color"))
21 wt_status_use_color = 1;
22 else if (!strcmp(argv[i], "--nocolor"))
23 wt_status_use_color = 0;
24 else if (!strcmp(argv[i], "--amend")) {
25 s.amend = 1;
26 s.reference = "HEAD^1";
28 else if (!strcmp(argv[i], "--verbose"))
29 s.verbose = 1;
30 else if (!strcmp(argv[i], "--untracked"))
31 s.untracked = 1;
32 else
33 usage(runstatus_usage);
36 wt_status_print(&s);
37 return s.commitable ? 0 : 1;