git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Cc: skillzero@gmail.com,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org
Subject: Re: git find (was: [RFC PATCH v3 8/8] --sparse for porcelains)
Date: Tue, 18 Aug 2009 18:00:38 +0200	[thread overview]
Message-ID: <200908181800.42136.jnareb@gmail.com> (raw)
In-Reply-To: <fcaeb9bf0908180735s583bfdcajc354723c9faa48@mail.gmail.com>

On Tue, Aug 18, 2009, Nguyen Thai Ngoc Duy wrote:
> On Tue, Aug 18, 2009 at 1:25 PM, Jakub Narebski<jnareb@gmail.com> wrote:
> >
> > Well, I also think that it would be nice and useful to have "git find"
> > in addition to current "git grep".
> 
> Can you make a draft on how you want "git find" to be? Except the
> "-exec" part, Git allows us to search using various commands
> (ls-files, rev-list, log). I don't think a single "git find" can cover
> them all. I was thinking about putting more find-options to search
> commands we already have. ls-files would support -exec, for example.

Both git-rev-list and git-ls-files are plumbing, not porcelain.  Among
tools / commands you have mentioned only git-log is porcelain.

You need to process output of git-ls-files if you want to use more
complicated search criteria. 

> 
> A few things that I'd love to have supported:
>  - --depth for ls-files (probably all pathspec-as-argument commands)
>  - logical combination of search criteria
>  - unified blob locator. git-show understands SHA-1:/path/to/blob
> syntax. What if git-log can output using similar syntax, then feed
> them to git-grep in order to grep through (across commits)?

Draft specification for git-find.  git-find, like git-grep, searches
the filesystem dimension, and not time dimension like git-log.

git-find(1)
===========

NAME
----
git-find - Search for files in a repository

SYNOPSIS
--------
'git find' [--cached] [-z|--null] [(<tree> | <path>)...] [<expression>]

OPTIONS
-------
--cached::
        Instead of searching in the working tree files, check
        the blobs registered in the index file.

EXPRESSIONS
-----------
The expression is made up of options (which affect overall operation rather
than the processing of a specific file, and always return true), tests
(which return a true or false value), and actions (which have side effects
and return a true or false value), all separated by operators. `--and`  is
assumed where the operator is omitted.  If the expression contains no
actions other than `--prune`, `--print` is performed on all files for which
the expression is true.

OPTIONS
~~~~~~~
--max-depth <levels>::
        Descend  at  most levels (a non-negative integer) levels of 
        directories below the command line arguments.   `--max-depth 0`
        means only apply the tests and actions to the command line 
        arguments.

--min-depth <levels>::
        Do not apply any tests or actions at levels less than levels 
        (a non-negative integer).  `--min-depth 1` means process all
        files except the  command line arguments.

TESTS
~~~~~
--false::
        Always false.

--true::
        Always true.

--name <pattern>::
--iname <pattern>::
--path <pattern>::
--ipath <pattern>::
        [Entire] Filename matches glob.

--regex <expr>::
--iregex <expr>::
        Entire file name matches regular expression.

--lname <pattern>::
--ilname <pattern>::
        True if the file is a symbolic link whose contents match glob.

--size <n>[<unit>]::
        True if the file uses N units of space, rounding up.

--empty::
        File is empty and is either a regular file or a directory.

--type <C>::
        True if file is of type C: 'd' for directory, 'f' for regular
        file, 'l' for symbolic link, 's' for submodule, 'x' for 
        executable regular file (replaces `-perm` from 'find').

ACTIONS
~~~~~~~
(--exec | --ok) <command> ;
        Execute command; true if 0 status is returned.

(--execdir | --okdir) <command> ;
        Like `--exec`, but the specified command is run from the 
        subdirectory containing the matched file.

--print::
--print0::
--printf <format>::
--fprint <file>::
--fprint0 <file>::
--fprintf <file> <format>::
        True; print the full file name.

--prune::
        True; if the file is a directory, do not descend into it.

--quit::
        Exit immediately.


OPERATORS
~~~~~~~~~
--and::
--or::
--not::
( ... )::
        Specify how multiple expressions are combined using Boolean
        expressions.  `--and` is the default operator.

-- 
Jakub Narebski
Poland

  reply	other threads:[~2009-08-18 16:01 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-11 15:43 [RFC PATCH v3 0/8] Sparse checkout Nguyễn Thái Ngọc Duy
2009-08-11 15:43 ` [RFC PATCH v3 1/8] Prevent diff machinery from examining assume-unchanged entries on worktree Nguyễn Thái Ngọc Duy
2009-08-11 15:44   ` [RFC PATCH v3 2/8] Avoid writing to buffer in add_excludes_from_file_1() Nguyễn Thái Ngọc Duy
2009-08-11 15:44     ` [RFC PATCH v3 3/8] Read .gitignore from index if it is assume-unchanged Nguyễn Thái Ngọc Duy
2009-08-11 15:44       ` [RFC PATCH v3 4/8] excluded_1(): support exclude "directories" in index Nguyễn Thái Ngọc Duy
2009-08-11 15:44         ` [RFC PATCH v3 5/8] dir.c: export excluded_1() and add_excludes_from_file_1() Nguyễn Thái Ngọc Duy
2009-08-11 15:44           ` [RFC PATCH v3 6/8] unpack-trees.c: generalize verify_* functions Nguyễn Thái Ngọc Duy
2009-08-11 15:44             ` [RFC PATCH v3 7/8] Support sparse checkout in unpack_trees() and read-tree Nguyễn Thái Ngọc Duy
2009-08-11 15:44               ` [RFC PATCH v3 8/8] --sparse for porcelains Nguyễn Thái Ngọc Duy
2009-08-12  6:33                 ` Junio C Hamano
2009-08-12 10:01                   ` Nguyen Thai Ngoc Duy
2009-08-13  7:20                   ` Nguyen Thai Ngoc Duy
2009-08-13  9:58                     ` Jakub Narebski
2009-08-13 12:38                       ` Nguyen Thai Ngoc Duy
2009-08-14 20:23                         ` Jakub Narebski
2009-08-15  2:01                           ` Junio C Hamano
2009-08-15 23:37                             ` Jakub Narebski
2009-08-16  8:14                               ` Johannes Schindelin
2009-08-17  9:08                                 ` Johannes Schindelin
2009-08-17 12:49                                   ` Nguyen Thai Ngoc Duy
2009-08-17 13:35                                     ` Johannes Schindelin
2009-08-17 14:41                                       ` Nguyen Thai Ngoc Duy
2009-08-17 15:19                                         ` Johannes Schindelin
2009-08-17 16:13                                           ` Nguyen Thai Ngoc Duy
2009-08-17 15:41                                   ` Junio C Hamano
2009-08-17 16:06                                     ` Nguyen Thai Ngoc Duy
2009-08-17 16:19                                     ` Johannes Schindelin
2009-08-17 18:39                                       ` Junio C Hamano
2009-08-17 22:02                                         ` Johannes Schindelin
2009-08-17 23:02                                           ` skillzero
2009-08-17 23:16                                             ` Johannes Schindelin
2009-08-18  0:17                                               ` Jakub Narebski
2009-08-18  0:34                                                 ` skillzero
2009-08-18  1:43                                                   ` Nguyen Thai Ngoc Duy
2009-08-18  6:25                                                     ` git find (was: [RFC PATCH v3 8/8] --sparse for porcelains) Jakub Narebski
2009-08-18 14:35                                                       ` Nguyen Thai Ngoc Duy
2009-08-18 16:00                                                         ` Jakub Narebski [this message]
2009-08-18  0:49                                                 ` [RFC PATCH v3 8/8] --sparse for porcelains Jakub Narebski
2009-08-18  0:23                                               ` skillzero
2009-08-17 16:46                                     ` Junio C Hamano
2009-08-17 21:45                                       ` Johannes Schindelin
2009-08-17 16:01                                 ` Jakub Narebski
2009-08-12  7:31                 ` Johannes Sixt
2009-08-12  9:53                   ` Nguyen Thai Ngoc Duy
2009-08-12 15:40                     ` Raja R Harinath
2009-08-13  7:37                       ` Johannes Sixt
2009-08-11 21:18               ` [RFC PATCH v3 7/8] Support sparse checkout in unpack_trees() and read-tree skillzero
2009-08-11 21:38                 ` Jakub Narebski
2009-08-11 22:03                   ` skillzero
2009-08-12  1:30                     ` Nguyen Thai Ngoc Duy
2009-08-12  4:59                       ` skillzero
2009-08-12  2:51       ` [RFC PATCH v3 3/8] Read .gitignore from index if it is assume-unchanged Junio C Hamano
2009-08-13  6:37         ` 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=200908181800.42136.jnareb@gmail.com \
    --to=jnareb@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pclouds@gmail.com \
    --cc=skillzero@gmail.com \
    /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).