From: Junio C Hamano <email@example.com> To: Ed Avis <firstname.lastname@example.org> Cc: "git\@vger.kernel.org" <email@example.com> Subject: Re: Feature request: 'git grep' over multiple working trees Date: Tue, 24 Mar 2020 11:40:09 -0700 Message-ID: <firstname.lastname@example.org> (raw) In-Reply-To: <MN2PR11MB3663C042590097D7A7F4B2409DF10@MN2PR11MB3663.namprd11.prod.outlook.com> (Ed Avis's message of "Tue, 24 Mar 2020 07:49:13 +0000") Ed Avis <email@example.com> writes: > If the current directory contains several git working trees (each > in its own subdirectory) then 'git grep' should search all of > them. It would be roughly equivalent to > > % for i in * ; do (cd $i ; git grep whatever); done > > except that the filenames listed would have the full path. I am not sure where that "should search" comes from. In my $HOME/w directory, I have working trees of various repositories, belonging to different and unrelated projects. Should "git grep foo" in there search in everywhre? Are you looking for "grep -r --exclude=.git" (not a git command at all)? In other words, surely anybody can wish anything nonsensical, but I do not quite see the point for adding such a mode to "Git". It sounds like saying 'git grep' "should" search all of them if the current directly is a git repository with several git commits, which would be roughly equivalent to git rev-list --all | while read rev do git grep -e pattern... $rev done Similarly, you could say that 'git grep' "should" search all of them if the current directory is a git repository with several branches, which would be roughly equivalent to git for-each-ref --format='%(objectname)' refs/heads/ | while read rev do git grep -e pattern... $rev done Neither of the above smell like a reasonable use of "should", at least to me, and yours does not, either. What is the real use case, if any, of what you are proposing?
next prev parent reply index Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-03-24 7:49 Ed Avis 2020-03-24 18:40 ` Junio C Hamano [this message] 2020-03-25 8:04 ` Ed Avis
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 \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.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
Git Mailing List Archive on lore.kernel.org Archives are clonable: git clone --mirror https://lore.kernel.org/git/0 git/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 git git/ https://lore.kernel.org/git \ firstname.lastname@example.org public-inbox-index git Example config snippet for mirrors Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.kernel.vger.git AGPL code for this site: git clone https://public-inbox.org/public-inbox.git