All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Lehmann <Jens.Lehmann@web.de>
To: Mikael Magnusson <mikachu@gmail.com>, Junio C Hamano <gitster@pobox.com>
Cc: Olaf Hering <olaf@aepfle.de>, git <git@vger.kernel.org>
Subject: Re: let git grep consider sub projects
Date: Wed, 08 Oct 2014 08:48:09 +0200	[thread overview]
Message-ID: <5434DE29.2010200@web.de> (raw)
In-Reply-To: <CAHYJk3Qrj3QfBK-MkcCS2AmyTz=AgCcruq7Df-YZKW24LMWTHg@mail.gmail.com>

Am 07.10.2014 um 21:12 schrieb Mikael Magnusson:
> On 7 October 2014 20:25, Junio C Hamano <gitster@pobox.com> wrote:
>> Olaf Hering <olaf@aepfle.de> writes:
>>
>>> How can I teach 'git grep $string' to also consider subprojects?
>>>
>>> The build system of xen.git clones 4 other trees into a directory in its
>>> source tree during build. It would be nice if my 'git grep' searches
>>> also in these cloned subdirs. Somehow there must be some knowledge
>>> because 'git clean -dfx' leaves them alone, while 'git clean -dffx'
>>> wipes everything.
>>>
>>> Olaf
>>>
>>> PS: Sometimes I miss a 'git clean -dfx --also-sub-repos' useful to
>>> really clean everything before starting over.
>>
>> Is "submodule foreach" under-advertised or with less than adequate
>> features?
>
> It sounds like in these use cases, you would want the commands to run
> on all the submodules but also in the parent repo, am I wrong in
> thinking that git submodule foreach does only the former part? So you
> would either need to make a wrapper thing yourself or run the command
> twice.

Yep, the workaround for a command "git foo" that hasn't learned the
--recurse-submodules option yet is

    git foo && git submodule foreach --recursive git foo

> In the first case with the git grep, I can also imagine that with some
> nontrivial patterns, having to quote the metacharacters not only once,
> but twice, can be a significant annoyance. Eg, first protect it from
> git submodule foreach parsing it, and then from the shell running the
> individual commands.

The long term goal is to teach git grep and git clean - and others -
the --recurse-submodules option. I'd be happy to help if someone
wants to work on that, as I'm busy working on another topic.

  reply	other threads:[~2014-10-08  6:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-07  8:29 let git grep consider sub projects Olaf Hering
2014-10-07 18:25 ` Junio C Hamano
2014-10-07 19:12   ` Mikael Magnusson
2014-10-08  6:48     ` Jens Lehmann [this message]
2014-10-08  6:59       ` Olaf Hering
2014-10-08  7:24         ` Jens Lehmann
2014-10-08  7:31           ` Olaf Hering

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=5434DE29.2010200@web.de \
    --to=jens.lehmann@web.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=mikachu@gmail.com \
    --cc=olaf@aepfle.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.