Re: git-grep to operate across who repository and not just CWD?
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 28, 2011, 18:32 UTC
- Message-ID
- <7vk4gkhuw4.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <AANLkTimJWeZLJbPndTyE0EUW3R9EC=yV55jhHbpZnnJn@mail.gmail.com>
Jay Soffian <jaysoffian@gmail.com> writes:
Show 6 quoted lines
> I had the crazy thought that if git had a --cdup option, then this > would work with any command you wanted to run from the top: > > git --cdup grep ... > > Maybe that's the best way to expose "from the top please" generically?
We tend to give --full-tree option to individual subcommands where it makes sense to get the same effect.
One problem with a global "git --cdup" is to sensibly handle pathspecs given from the command line. You would likely want
$ cd Documentation
$ git --cdup grep -e info pu Makefile '*.txt'to still refer to Makefile relative to Documentation/ directory (imagine typing "Makef<TAB>" to complete while forming that command line) while looking for '*.txt' files everywhere in the tree, but only individual commands can tell which parameters are pathspec in argv[]. Hence the subcommands have to be aware of the wish (--cdup or --full-tree) of the user to affect the full tree, not limited to the current working directory.