1
0
mirror of https://github.com/git/git.git synced 2024-10-01 14:11:31 +02:00
git/builtin-runstatus.c
Johannes Schindelin 367c98866c git status: show relative paths when run in a subdirectory
To show the relative paths, the function formerly called quote_crlf()
(now called quote_path()) takes the prefix as an additional argument.

While at it, the static buffers were replaced by strbufs.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 17:05:03 -08:00

39 lines
853 B
C

#include "builtin.h"
#include "cache.h"
#include "wt-status.h"
extern int wt_status_use_color;
static const char runstatus_usage[] =
"git-runstatus [--color|--nocolor] [--amend] [--verbose] [--untracked]";
int cmd_runstatus(int argc, const char **argv, const char *prefix)
{
struct wt_status s;
int i;
git_config(git_status_config);
wt_status_prepare(&s);
s.prefix = prefix;
for (i = 1; i < argc; i++) {
if (!strcmp(argv[i], "--color"))
wt_status_use_color = 1;
else if (!strcmp(argv[i], "--nocolor"))
wt_status_use_color = 0;
else if (!strcmp(argv[i], "--amend")) {
s.amend = 1;
s.reference = "HEAD^1";
}
else if (!strcmp(argv[i], "--verbose"))
s.verbose = 1;
else if (!strcmp(argv[i], "--untracked"))
s.untracked = 1;
else
usage(runstatus_usage);
}
wt_status_print(&s);
return s.commitable ? 0 : 1;
}