[PATCH 09/21] list-files: a user friendly version of ls-files and more

2015-02-08 Thread Nguyễn Thái Ngọc Duy
This is more user friendly version of ls-files:

 * it's automatically colored and columnized
 * it refreshes the index like all porcelain commands
 * it defaults to non-recursive behavior like ls
 * :(glob) is on by default so '*.c' means a.c but not a/b.c, use
   '**/*.c' for that.
 * auto pager

The name 'ls' is not taken. It is left for the user to make an alias
with better default options.

Helped-by: Junio C Hamano 
Signed-off-by: Nguyễn Thái Ngọc Duy 
---
 .gitignore |  1 +
 Documentation/config.txt   | 10 +
 Documentation/git-list-files.txt (new) | 80 ++
 Makefile   |  1 +
 builtin/ls-files.c | 69 +++--
 command-list.txt   |  1 +
 git.c  |  1 +
 7 files changed, 159 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/git-list-files.txt

diff --git a/.gitignore b/.gitignore
index a052419..9727ecc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -76,6 +76,7 @@
 /git-init-db
 /git-interpret-trailers
 /git-instaweb
+/git-list-files
 /git-log
 /git-ls-files
 /git-ls-remote
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 2290c47..2dc4788 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -940,6 +940,12 @@ color.status.::
to red). The values of these variables may be specified as in
color.branch..
 
+color.listFiles::
+   A boolean to enable/disable color in the output of
+   linkgit:git-list-files[1]. May be set to `always`, `false` (or
+   `never`) or `auto` (or `true`), in which case colors are used
+   only when the output is to a terminal. Defaults to false.
+
 color.ls.::
Use customized color for file name colorization. If not set
and the environment variable LS_COLORS is set, color settings
@@ -1012,6 +1018,10 @@ column.clean::
Specify the layout when list items in `git clean -i`, which always
shows files and directories in columns. See `column.ui` for details.
 
+column.listFiles::
+   Specify whether to output tag listing in `git list-files` in columns.
+   See `column.ui` for details.
+
 column.status::
Specify whether to output untracked files in `git status` in columns.
See `column.ui` for details.
diff --git a/Documentation/git-list-files.txt b/Documentation/git-list-files.txt
new file mode 100644
index 000..3039e1e
--- /dev/null
+++ b/Documentation/git-list-files.txt
@@ -0,0 +1,80 @@
+git-list-files(1)
+===
+
+NAME
+
+git-list-files - List files
+
+SYNOPSIS
+
+[verse]
+'git list-files [options] [...]
+
+DESCRIPTION
+---
+List files (by default in current working directory) that are in the
+index. Depending on the chosen options, maybe only modified files in
+working tree are shown, or untracked files...
+
+OPTIONS
+---
+-c::
+--cached::
+   Show cached files (default)
+
+-d::
+--deleted::
+   Show cached files that are deleted on working directory
+
+-m::
+--modified::
+   Show cached files that have modification on working directory
+
+-o::
+--others::
+   Show untracked files (and only unignored ones unless -i is
+   specified)
+
+-i::
+--ignored::
+   Show only ignored files. When showing files in the index,
+   print only those matched by an exclude pattern. When showing
+   "other" files, show only those matched by an exclude pattern.
+
+-u::
+--unmerged::
+   Show unmerged files
+
+--color[=]::
+--no-color::
+   Color file names. The value must be `always`, `never`, or
+   `auto`. `--no-color` is equivalent to
+   `--color=never`. `--color` is equivalent to
+   `--color=auto`. See configuration variable `color.list-files`
+   for the default settings.
+
+--column[=]::
+--no-column::
+   Display files in columns. See configuration variable column.ui
+   for option syntax. `--column` and `--no-column` without options
+   are equivalent to 'always' and 'never' respectively.
+
+--max-depth=::
+   For each  given on command line, descend at most 
+   levels of directories. A negative value means no limit.
+   This option is ignored if  contains active wildcards.
+   In other words if "a*" matches a directory named "a*",
+   "*" is matched literally so --max-depth is still effective.
+   The default is `--max-depth=0`.
+
+::
+   Files to show. :(glob) magic is enabled and recursion disabled
+   by default.
+
+SEE ALSO
+
+linkgit:git-ls-files[1]
+
+GIT
+---
+Part of the linkgit:git[1] suite
diff --git a/Makefile b/Makefile
index 459121d..23a0751 100644
--- a/Makefile
+++ b/Makefile
@@ -587,6 +587,7 @@ BUILT_INS += git-cherry-pick$X
 BUILT_INS += git-format-patch$X
 BUILT_INS += git-fsck-objects$X
 BUILT_INS += git-init$X
+BUILT_INS += git-list-files$X
 BUILT_INS += git-merge-subtree$X
 BUILT_INS += git-show$X
 BUIL

Re: [PATCH 09/21] list-files: a user friendly version of ls-files and more

2015-01-27 Thread Junio C Hamano
Nguyễn Thái Ngọc Duy   writes:

> +color.list-files::
> + A boolean to enable/disable color in the output of
> + linkgit:git-list-files[1]. May be set to `always`, `false` (or
> + `never`) or `auto` (or `true`), in which case colors are used
> + only when the output is to a terminal. Defaults to false.

This violates the configuration variable naming rules; perhaps
rename it to color.listFiles or something?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 09/21] list-files: a user friendly version of ls-files and more

2015-01-25 Thread Nguyễn Thái Ngọc Duy
This is more user friendly version of ls-files:

 * it's automatically colored and columnized
 * it refreshes the index like all porcelain commands
 * it defaults to non-recursive behavior like ls
 * :(glob) is on by default so '*.c' means a.c but not a/b.c, use
   '**/*.c' for that.
 * auto pager

The name 'ls' is not taken. It is left for the user to make an alias
with better default options.

Signed-off-by: Nguyễn Thái Ngọc Duy 
---
 .gitignore |  1 +
 Documentation/config.txt   | 10 +
 Documentation/git-list-files.txt (new) | 80 ++
 Makefile   |  1 +
 builtin/ls-files.c | 69 +++--
 command-list.txt   |  1 +
 git.c  |  1 +
 7 files changed, 159 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/git-list-files.txt

diff --git a/.gitignore b/.gitignore
index a052419..9727ecc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -76,6 +76,7 @@
 /git-init-db
 /git-interpret-trailers
 /git-instaweb
+/git-list-files
 /git-log
 /git-ls-files
 /git-ls-remote
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 2290c47..74da715 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -940,6 +940,12 @@ color.status.::
to red). The values of these variables may be specified as in
color.branch..
 
+color.list-files::
+   A boolean to enable/disable color in the output of
+   linkgit:git-list-files[1]. May be set to `always`, `false` (or
+   `never`) or `auto` (or `true`), in which case colors are used
+   only when the output is to a terminal. Defaults to false.
+
 color.ls.::
Use customized color for file name colorization. If not set
and the environment variable LS_COLORS is set, color settings
@@ -1012,6 +1018,10 @@ column.clean::
Specify the layout when list items in `git clean -i`, which always
shows files and directories in columns. See `column.ui` for details.
 
+column.list-files::
+   Specify whether to output tag listing in `git list-files` in columns.
+   See `column.ui` for details.
+
 column.status::
Specify whether to output untracked files in `git status` in columns.
See `column.ui` for details.
diff --git a/Documentation/git-list-files.txt b/Documentation/git-list-files.txt
new file mode 100644
index 000..3039e1e
--- /dev/null
+++ b/Documentation/git-list-files.txt
@@ -0,0 +1,80 @@
+git-list-files(1)
+===
+
+NAME
+
+git-list-files - List files
+
+SYNOPSIS
+
+[verse]
+'git list-files [options] [...]
+
+DESCRIPTION
+---
+List files (by default in current working directory) that are in the
+index. Depending on the chosen options, maybe only modified files in
+working tree are shown, or untracked files...
+
+OPTIONS
+---
+-c::
+--cached::
+   Show cached files (default)
+
+-d::
+--deleted::
+   Show cached files that are deleted on working directory
+
+-m::
+--modified::
+   Show cached files that have modification on working directory
+
+-o::
+--others::
+   Show untracked files (and only unignored ones unless -i is
+   specified)
+
+-i::
+--ignored::
+   Show only ignored files. When showing files in the index,
+   print only those matched by an exclude pattern. When showing
+   "other" files, show only those matched by an exclude pattern.
+
+-u::
+--unmerged::
+   Show unmerged files
+
+--color[=]::
+--no-color::
+   Color file names. The value must be `always`, `never`, or
+   `auto`. `--no-color` is equivalent to
+   `--color=never`. `--color` is equivalent to
+   `--color=auto`. See configuration variable `color.list-files`
+   for the default settings.
+
+--column[=]::
+--no-column::
+   Display files in columns. See configuration variable column.ui
+   for option syntax. `--column` and `--no-column` without options
+   are equivalent to 'always' and 'never' respectively.
+
+--max-depth=::
+   For each  given on command line, descend at most 
+   levels of directories. A negative value means no limit.
+   This option is ignored if  contains active wildcards.
+   In other words if "a*" matches a directory named "a*",
+   "*" is matched literally so --max-depth is still effective.
+   The default is `--max-depth=0`.
+
+::
+   Files to show. :(glob) magic is enabled and recursion disabled
+   by default.
+
+SEE ALSO
+
+linkgit:git-ls-files[1]
+
+GIT
+---
+Part of the linkgit:git[1] suite
diff --git a/Makefile b/Makefile
index 459121d..23a0751 100644
--- a/Makefile
+++ b/Makefile
@@ -587,6 +587,7 @@ BUILT_INS += git-cherry-pick$X
 BUILT_INS += git-format-patch$X
 BUILT_INS += git-fsck-objects$X
 BUILT_INS += git-init$X
+BUILT_INS += git-list-files$X
 BUILT_INS += git-merge-subtree$X
 BUILT_INS += git-show$X
 BUILT_INS += git-stage$X
diff