git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 4/7] add core.column
Date: Tue,  8 Feb 2011 22:22:18 +0700	[thread overview]
Message-ID: <1297178541-31124-5-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <1297178541-31124-1-git-send-email-pclouds@gmail.com>

This takes auto, never or always to enable column output for
porcelain commands.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Documentation/config.txt |    8 ++++++++
 cache.h                  |    1 +
 config.c                 |   16 ++++++++++++++++
 environment.c            |    1 +
 4 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index c5e1835..6d7151b 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -567,6 +567,14 @@ core.sparseCheckout::
 	Enable "sparse checkout" feature. See section "Sparse checkout" in
 	linkgit:git-read-tree[1] for more information.
 
+core.column::
+	Specify whether a command should output in columns. Only commands
+	that support `--column` will be affected by this. This variable can
+	take either `never` (do not output in columns), `auto` (output in
+	columns if the output is to a terminal) or `always` (always output in
+	columns). Setting `--column` or `--no-column` will override this
+	variable. This option defaults to never.
+
 add.ignore-errors::
 add.ignoreErrors::
 	Tells 'git add' to continue adding files when some files cannot be
diff --git a/cache.h b/cache.h
index bcbd5f2..1fa7656 100644
--- a/cache.h
+++ b/cache.h
@@ -559,6 +559,7 @@ extern int read_replace_refs;
 extern int fsync_object_files;
 extern int core_preload_index;
 extern int core_apply_sparse_checkout;
+extern int core_column;
 
 enum safe_crlf {
 	SAFE_CRLF_FALSE = 0,
diff --git a/config.c b/config.c
index 625e051..071899f 100644
--- a/config.c
+++ b/config.c
@@ -9,6 +9,8 @@
 #include "exec_cmd.h"
 #include "strbuf.h"
 #include "quote.h"
+#include "color.h"
+#include "column.h"
 
 #define MAXNAME (256)
 
@@ -660,6 +662,20 @@ static int git_default_core_config(const char *var, const char *value)
 		return 0;
 	}
 
+	if (!strcmp(var, "core.column")) {
+		switch (git_config_colorbool(var, value, -1)) {
+		case 0:
+			core_column = COL_PLAIN;
+			break;
+		case 1:
+			core_column = COL_COLUMN_FIRST;
+			break;
+		case -1:
+			return -1;
+		}
+		return 0;
+	}
+
 	/* Add other config variables here and to Documentation/config.txt. */
 	return 0;
 }
diff --git a/environment.c b/environment.c
index 9564475..b420ea2 100644
--- a/environment.c
+++ b/environment.c
@@ -56,6 +56,7 @@ char *notes_ref_name;
 int grafts_replace_parents = 1;
 int core_apply_sparse_checkout;
 struct startup_info *startup_info;
+int core_column;
 
 /* Parallel index stat data preload? */
 int core_preload_index = 0;
-- 
1.7.2.2

  parent reply	other threads:[~2011-02-08 15:24 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-08 15:22 [PATCH/RFC 0/7] Column output Nguyễn Thái Ngọc Duy
2011-02-08 15:22 ` [PATCH 1/7] Move term_columns() to pager.c and save terminal width before pager Nguyễn Thái Ngọc Duy
2011-02-09  5:14   ` Jonathan Nieder
2011-02-08 15:22 ` [PATCH 2/7] Add column layout Nguyễn Thái Ngọc Duy
2011-02-09  7:36   ` Jonathan Nieder
2011-02-09 11:24     ` Nguyen Thai Ngoc Duy
2011-02-08 15:22 ` [PATCH 3/7] parseopt: OPT_COLUMN to set struct column_layout.mode Nguyễn Thái Ngọc Duy
2011-02-08 15:22 ` Nguyễn Thái Ngọc Duy [this message]
2011-02-08 15:22 ` [PATCH 5/7] help: reuse struct column_layout Nguyễn Thái Ngọc Duy
2011-02-09  7:39   ` Jonathan Nieder
2011-02-09 11:21     ` Nguyen Thai Ngoc Duy
2011-02-08 15:22 ` [PATCH 6/7] tag: support column output with --column Nguyễn Thái Ngọc Duy
2011-02-09 21:51   ` Junio C Hamano
2011-02-10  2:35     ` Nguyen Thai Ngoc Duy
2011-02-10  2:54       ` Miles Bader
2011-02-08 15:22 ` [PATCH 7/7] branch: " Nguyễn Thái Ngọc Duy
2011-02-08 22:47 ` [PATCH/RFC 0/7] Column output Jeff King
2011-02-09  0:13   ` Nguyen Thai Ngoc Duy
2011-02-09  5:42     ` Jonathan Nieder
2011-02-09  5:59       ` Nguyen Thai Ngoc Duy

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=1297178541-31124-5-git-send-email-pclouds@gmail.com \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    /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).