git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 4/7] add core.column

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Feb 8, 2011, 15:22 UTC
Message-ID
<1297178541-31124-5-git-send-email-pclouds@gmail.com>
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
Previous: Nguyễn Thái Ngọc DuyNext: Nguyễn Thái Ngọc Duy
Message 8 of 20 in “Column output”
  1. 0/7 Column outputNguyễn Thái Ngọc Duy, Feb 8, 2011
  2. 1/7 Move term_columns() to pager.c and save terminal width before pagerNguyễn Thái Ngọc Duy, Feb 8, 2011
  3. Jonathan NiederFeb 9, 2011
  4. 2/7 Add column layoutNguyễn Thái Ngọc Duy, Feb 8, 2011
  5. Jonathan NiederFeb 9, 2011
  6. Nguyen Thai Ngoc DuyFeb 9, 2011
  7. 3/7 parseopt: OPT_COLUMN to set struct column_layout.modeNguyễn Thái Ngọc Duy, Feb 8, 2011
  8. 4/7 add core.columnNguyễn Thái Ngọc Duy, Feb 8, 2011
  9. 5/7 help: reuse struct column_layoutNguyễn Thái Ngọc Duy, Feb 8, 2011
  10. Jonathan NiederFeb 9, 2011
  11. Nguyen Thai Ngoc DuyFeb 9, 2011
  12. 6/7 tag: support column output with --columnNguyễn Thái Ngọc Duy, Feb 8, 2011
  13. Junio C HamanoFeb 9, 2011
  14. Nguyen Thai Ngoc DuyFeb 10, 2011
  15. Miles BaderFeb 10, 2011
  16. 7/7 branch: support column output with --columnNguyễn Thái Ngọc Duy, Feb 8, 2011
  17. Jeff KingFeb 8, 2011
  18. Nguyen Thai Ngoc DuyFeb 9, 2011
  19. Jonathan NiederFeb 9, 2011
  20. Nguyen Thai Ngoc DuyFeb 9, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.