summaryrefslogtreecommitdiff
path: root/column.h
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2012-03-13 19:11:36 +0700
committerJunio C Hamano <gitster@pobox.com>2012-03-13 15:25:14 -0700
commita464ab919cd61d84c316ae1d9bfba391c1a5eb3e (patch)
treef31321be06fb3999e3491f40f7d7707c887beb36 /column.h
parentee8a84f773a289f777e4de1ad6d40f8f89987f2c (diff)
downloadgit-nd/columns.tar.gz
column: support grouping entriesnd/columns
If many entries share the same prefix (e.g. "git ls-files Documentation/"), cutting out the prefix helps put more information on the same space. If "group" is specified, the list of entries will be searched for largest non-overlapping rectangles of text. Estimation is done on each rectangle to see if there are any savings in rows if we group them. Groups are printed first, then the remaining as the last group. Handling the remaining part this way may not be ideal but I don't want to split all directories like "ls -R". That takes too many lines. Maybe I should prepend ".../" to all grouped items to make it clear they are grouped. There's also problem with ansi escape codes that I'll need to handle if this sounds like a good way to go. This code may be used for diffstat too (e.g. when most of the diff is in Documentation/). For demonstration, this is what "COLUMNS=80 git ls-files --column=group -- '*.[ch]'" looks like builtin/: add.c gc.c read-tree.c annotate.c grep.c receive-pack.c <snip> for-each-ref.c prune.c verify-tag.c fsck.c push.c write-tree.c compat/: basename.c regex/regexec.c bswap.h setenv.c <snip> regex/regex_internal.c win32mmap.c regex/regex_internal.h winansi.c contrib/: convert-objects/convert-objects.c credential/osxkeychain/git-credential-osxkeychain.c examples/builtin-fetch--tool.c svn-fe/svn-fe.c vcs-svn/: fast_export.c line_buffer.h sliding_window.c svndiff.h fast_export.h repo_tree.c sliding_window.h svndump.c line_buffer.c repo_tree.h svndiff.c svndump.h xdiff/: xdiff.h xemit.c xinclude.h xpatience.c xtypes.h xdiffi.c xemit.h xmacros.h xprepare.c xutils.c xdiffi.h xhistogram.c xmerge.c xprepare.h xutils.h ...: abspath.c pack-check.c advice.c pack-refs.c <snip> object.c xdiff-interface.h object.h zlib.c Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'column.h')
-rw-r--r--column.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/column.h b/column.h
index dbc5da2e51..f3934cfd5f 100644
--- a/column.h
+++ b/column.h
@@ -7,6 +7,7 @@
#define COL_DENSE 0x0080 /* Shrink columns when possible,
making space for more columns */
#define COL_DENSER 0x0100
+#define COL_GROUP 0x0200
#define COL_ENABLE(c) ((c) & COL_ENABLE_MASK)
#define COL_DISABLED 0x0000 /* must be zero */