Re: git-grep ignores untracked files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>  Look for specified patterns in the working tree files, blobs
> -registered in the index file, or given tree objects.
> +registered in the index file, or given tree objects.  Only tracked files in
> +the working tree are searched.  Paths that do not match are silently ignored,
> +including paths to untracked files.

Strictly speaking, because git commands are about tracked files unless
explicitly stated otherwise, the phrase "files in the work tree" already
means "tracked" ones.  It is understandable (but not excusable) that
people who wrote manual assumed the readers would have learned that from
the user manual without repeating.  Adding explicit description would be a
good thing to do.

I think rewording the paragraph to "... patterns in the tracked files in
the work tree, blobs registered in the index file, ... or given tree
objects."  would be a good balance to strike.  It gives enough information
without making it too verbose.

I doubt we want to have "Only tracked files blah blah".  Like all the
normal git commands, "grep" is about tracked contents, and I don't think
it would help to repeat the obvious like pathspec filter will act as a
filter.  "add <pathspec>" is an exception in that it _is_ about untracked
paths and that is why you get warnings for unmatched ones.

    Side note: there will be --no-index option to let you run "git grep"
    over files in a random directory.

> +<path>...::
> +	Only search files matching these wildcard patterns; see glob(7) for
> +	the format.  If not given, all tracked files in the tree are searched.

Please do *not* "see glob(7) for the format".  Pathspec used for "grep"
(and "ls-files") are "leading path match or glob(7)".  E.g. "git grep
frotz t/" looks for frotz in all files under "t/" recursively, and that
does not have much to do with glob(7).  If we do not have a description
already, we may want to add these basics to git(1) or the user manual.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]