summaryrefslogtreecommitdiff
path: root/builtin/commit.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2012-05-07 21:09:04 (GMT)
committerJeff King <peff@peff.net>2012-05-08 08:51:08 (GMT)
commitd4a6bf1fb64d904e210fbf7c5b330b06438a5bd5 (patch)
treee730861e04c858757025a81f93df92d3f10e8729 /builtin/commit.c
parenta5985237878481af5fbca349d0d1ad7d6b2d2bcb (diff)
downloadgit-d4a6bf1fb64d904e210fbf7c5b330b06438a5bd5.zip
git-d4a6bf1fb64d904e210fbf7c5b330b06438a5bd5.tar.gz
git-d4a6bf1fb64d904e210fbf7c5b330b06438a5bd5.tar.bz2
status: respect "-b" for porcelain format
There is no reason not to, as the user has to explicitly ask for it, so we are not breaking compatibility by doing so. We can do this simply by moving the "show_branch" flag into the wt_status struct. As a bonus, this saves us from passing it explicitly, simplifying the code. Signed-off-by: Jeff King <peff@peff.net>
Diffstat (limited to 'builtin/commit.c')
-rw-r--r--builtin/commit.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/builtin/commit.c b/builtin/commit.c
index 85cbeef..e2d9cbe 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -114,7 +114,6 @@ static enum {
STATUS_FORMAT_SHORT,
STATUS_FORMAT_PORCELAIN
} status_format = STATUS_FORMAT_LONG;
-static int status_show_branch;
static int opt_parse_m(const struct option *opt, const char *arg, int unset)
{
@@ -459,7 +458,7 @@ static int run_status(FILE *fp, const char *index_file, const char *prefix, int
switch (status_format) {
case STATUS_FORMAT_SHORT:
- wt_shortstatus_print(s, status_show_branch);
+ wt_shortstatus_print(s);
break;
case STATUS_FORMAT_PORCELAIN:
wt_porcelain_print(s);
@@ -1175,7 +1174,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)
OPT__VERBOSE(&verbose, "be verbose"),
OPT_SET_INT('s', "short", &status_format,
"show status concisely", STATUS_FORMAT_SHORT),
- OPT_BOOLEAN('b', "branch", &status_show_branch,
+ OPT_BOOLEAN('b', "branch", &s.show_branch,
"show branch information"),
OPT_SET_INT(0, "porcelain", &status_format,
"machine-readable output",
@@ -1230,7 +1229,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)
switch (status_format) {
case STATUS_FORMAT_SHORT:
- wt_shortstatus_print(&s, status_show_branch);
+ wt_shortstatus_print(&s);
break;
case STATUS_FORMAT_PORCELAIN:
wt_porcelain_print(&s);
@@ -1402,7 +1401,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
OPT_BOOLEAN(0, "dry-run", &dry_run, "show what would be committed"),
OPT_SET_INT(0, "short", &status_format, "show status concisely",
STATUS_FORMAT_SHORT),
- OPT_BOOLEAN(0, "branch", &status_show_branch, "show branch information"),
+ OPT_BOOLEAN(0, "branch", &s.show_branch, "show branch information"),
OPT_SET_INT(0, "porcelain", &status_format,
"machine-readable output", STATUS_FORMAT_PORCELAIN),
OPT_BOOLEAN('z', "null", &s.null_termination,