summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: dd2be24)
raw | patch | inline | side by side (parent: dd2be24)
author | Jeff King <peff@peff.net> | |
Sat, 5 Sep 2009 08:55:37 +0000 (04:55 -0400) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 6 Sep 2009 06:16:31 +0000 (23:16 -0700) |
The "short" format was added to "git status" recently to
provide a less verbose way of looking at the same
information. This has two practical uses:
1. Users who want a more dense display of the information.
2. Scripts which want to parse the information and need a
stable, easy-to-parse interface.
For now, the "--short" format covers both of those uses.
However, as time goes on, users of (1) may want additional
format tweaks, or for "git status" to change its behavior
based on configuration variables. Those wishes will be at
odds with (2), which wants to stability for scripts.
This patch introduces a separate --porcelain option early to
avoid problems later on. Right now the --short and
--porcelain outputs are identical. However, as time goes on,
we will have the freedom to customize --short for human
consumption while keeping --porcelain stable.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
provide a less verbose way of looking at the same
information. This has two practical uses:
1. Users who want a more dense display of the information.
2. Scripts which want to parse the information and need a
stable, easy-to-parse interface.
For now, the "--short" format covers both of those uses.
However, as time goes on, users of (1) may want additional
format tweaks, or for "git status" to change its behavior
based on configuration variables. Those wishes will be at
odds with (2), which wants to stability for scripts.
This patch introduces a separate --porcelain option early to
avoid problems later on. Right now the --short and
--porcelain outputs are identical. However, as time goes on,
we will have the freedom to customize --short for human
consumption while keeping --porcelain stable.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-status.txt | patch | blob | history | |
builtin-commit.c | patch | blob | history |
index b5939d6b58dab1baa18ab2bef59893c35ede965e..e9363d99782651e40a3e44873a325e78bb0c0af7 100644 (file)
--short::
Give the output in the short-format.
+--porcelain::
+ Give the output in a stable, easy-to-parse format for scripts.
+ Currently this is identical to --short output, but is guaranteed
+ not to change in the future, making it safe for scripts.
+
-u[<mode>]::
--untracked-files[=<mode>]::
Show untracked files (Default: 'all').
specified.
-z::
- Terminate entries with NUL, instead of LF. This implies `-s`
- (short status) output format.
+ Terminate entries with NUL, instead of LF. This implies
+ the `--porcelain` output format if no other format is given.
OUTPUT
diff --git a/builtin-commit.c b/builtin-commit.c
index aa4a3587990c73a2359f33aaab10529789a9e58a..ffdee31bbfe1f123dd4e0868f1cc75578fb33521 100644 (file)
--- a/builtin-commit.c
+++ b/builtin-commit.c
static enum {
STATUS_FORMAT_LONG,
STATUS_FORMAT_SHORT,
+ STATUS_FORMAT_PORCELAIN,
} status_format = STATUS_FORMAT_LONG;
unsigned char sha1[20];
static struct option builtin_status_options[] = {
OPT__VERBOSE(&verbose),
OPT_SET_INT('s', "short", &status_format,
"show status concisely", STATUS_FORMAT_SHORT),
+ OPT_SET_INT(0, "porcelain", &status_format,
+ "show porcelain output format",
+ STATUS_FORMAT_PORCELAIN),
OPT_BOOLEAN('z', "null", &null_termination,
"terminate entries with NUL"),
{ OPTION_STRING, 'u', "untracked-files", &untracked_files_arg,
};
if (null_termination && status_format == STATUS_FORMAT_LONG)
- status_format = STATUS_FORMAT_SHORT;
+ status_format = STATUS_FORMAT_PORCELAIN;
wt_status_prepare(&s);
git_config(git_status_config, &s);
case STATUS_FORMAT_SHORT:
short_print(&s, null_termination);
break;
+ case STATUS_FORMAT_PORCELAIN:
+ short_print(&s, null_termination);
+ break;
case STATUS_FORMAT_LONG:
s.verbose = verbose;
if (s.relative_paths)