From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>, "Jeff King" <peff@peff.net>,
"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH v2 2/2] status: add --long for default format
Date: Thu, 18 Oct 2012 08:58:00 +0700 [thread overview]
Message-ID: <1350525480-30395-2-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <1350525480-30395-1-git-send-email-pclouds@gmail.com>
This could be useful when the user sets an alias to "status --short"
and wants to get the default format back temporarily.
git-commit also learns --long mostly for consistency as there's little
chance that someone adds an alias for "git commit --short" then wants
a one shot --long output.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
Documentation/git-commit.txt | 4 ++++
Documentation/git-status.txt | 3 +++
builtin/commit.c | 10 ++++++++++
3 files changed, 17 insertions(+)
diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
index 9594ac8..3acf2e7 100644
--- a/Documentation/git-commit.txt
+++ b/Documentation/git-commit.txt
@@ -109,6 +109,10 @@ OPTIONS
format. See linkgit:git-status[1] for details. Implies
`--dry-run`.
+--long::
+ When doing a dry-run, give the output in a the long-format.
+ Implies `--dry-run`.
+
-z::
--null::
When showing `short` or `porcelain` status output, terminate
diff --git a/Documentation/git-status.txt b/Documentation/git-status.txt
index 67e5f53..9f1ef9a 100644
--- a/Documentation/git-status.txt
+++ b/Documentation/git-status.txt
@@ -38,6 +38,9 @@ OPTIONS
across git versions and regardless of user configuration. See
below for details.
+--long::
+ Give the output in the long-format. This is the default.
+
-u[<mode>]::
--untracked-files[=<mode>]::
Show untracked files.
diff --git a/builtin/commit.c b/builtin/commit.c
index 984e29c..1dd2ec5 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1063,6 +1063,8 @@ static int parse_and_validate_options(int argc, const char *argv[],
if (s->null_termination) {
if (status_format == STATUS_FORMAT_NONE)
status_format = STATUS_FORMAT_PORCELAIN;
+ else if (status_format == STATUS_FORMAT_LONG)
+ die(_("--long and -z are incompatible"));
}
if (status_format != STATUS_FORMAT_NONE)
dry_run = 1;
@@ -1163,6 +1165,9 @@ int cmd_status(int argc, const char **argv, const char *prefix)
OPT_SET_INT(0, "porcelain", &status_format,
N_("machine-readable output"),
STATUS_FORMAT_PORCELAIN),
+ OPT_SET_INT(0, "long", &status_format,
+ N_("show status in long format (default)"),
+ STATUS_FORMAT_LONG),
OPT_BOOLEAN('z', "null", &s.null_termination,
N_("terminate entries with NUL")),
{ OPTION_STRING, 'u', "untracked-files", &untracked_files_arg,
@@ -1193,6 +1198,8 @@ int cmd_status(int argc, const char **argv, const char *prefix)
if (s.null_termination) {
if (status_format == STATUS_FORMAT_NONE)
status_format = STATUS_FORMAT_PORCELAIN;
+ else if (status_format == STATUS_FORMAT_LONG)
+ die(_("--long and -z are incompatible"));
}
handle_untracked_files_arg(&s);
@@ -1393,6 +1400,9 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
OPT_BOOLEAN(0, "branch", &s.show_branch, N_("show branch information")),
OPT_SET_INT(0, "porcelain", &status_format,
N_("machine-readable output"), STATUS_FORMAT_PORCELAIN),
+ OPT_SET_INT(0, "long", &status_format,
+ N_("show status in long format (default)"),
+ STATUS_FORMAT_LONG),
OPT_BOOLEAN('z', "null", &s.null_termination,
N_("terminate entries with NUL")),
OPT_BOOLEAN(0, "amend", &amend, N_("amend previous commit")),
--
1.8.0.rc2.32.g1729c8c
next prev parent reply other threads:[~2012-10-18 1:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-16 16:22 [PATCH] status: add --long for default format Nguyễn Thái Ngọc Duy
2012-10-16 17:22 ` Jeff King
2012-10-16 18:32 ` Jeff King
2012-10-18 1:57 ` [PATCH v2 1/2] status: refactor output format to represent "default" Nguyễn Thái Ngọc Duy
2012-10-18 1:58 ` Nguyễn Thái Ngọc Duy [this message]
2012-10-18 2:03 ` Jeff King
2012-10-18 14:15 ` [PATCH v3] status: refactor output format to represent "default" and add --long Nguyễn Thái Ngọc Duy
2012-10-18 20:26 ` Jeff King
2012-10-18 21:16 ` Junio C Hamano
2012-10-18 21:20 ` Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1350525480-30395-2-git-send-email-pclouds@gmail.com \
--to=pclouds@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).