Re: Finding the repository
- From
Phil Hord <phil.hord@gmail.com>
- Date
- Oct 25, 2013, 03:09 UTC
- Message-ID
- <CABURp0rFPYZEDC95+pL7bvnFuMpsiqp_YoQJ6f0DSFYWP=v4Gw@mail.gmail.com>
- In-Reply-To
- <CACsJy8AVdV8nPXFVdj37O1dgvcWh=tQ5C7iUE134Wk2yTD42Ug@mail.gmail.com>
On Thu, Oct 24, 2013 at 9:46 AM, Duy Nguyen <pclouds@gmail.com> wrote:
Show 6 quoted lines
> On Thu, Oct 24, 2013 at 2:49 PM, Perry Hutchison <perryh@pluto.rain.com> wrote: >> Duy Nguyen <pclouds@gmail.com> wrote: >> >>> ... it's not easy to determine ambiguity here, especially when the >>> repo finding code does not know anything about "bar/barz.c" (is it >>> a pathname or an argument to an option?).
...
Show 15 quoted lines
>>> There are more cases to consider, like what if you do >>> "git rm bar/baz.c and rab/zab.c" where bar and rab are >>> two different repositories.. >> >> So we remove baz.c from bar and zab.c from rab. It's not clear >> to me that there's anything wrong with that -- it's exactly what >> I would expect to have happen (and also what the hackish script >> I posted will do). > > For "git rm", maybe. Many other commands need repo information and it > would not make sense to have paths from two different repositories. > For example, commit, rev-list or log. And it may break more things as > most of current commands are designed to work on one repo from a to z. > Some may support multi-repo operations if they're part of submodule > support.
I've done some preliminary work on extending this sort of behavior to submodule commands. For example,
git grep --recurse-submodules foo
which would look in the current project path and also any submodules encountered. This usage also begs for this extension:
git grep --recurse-submodules foo path/to/sub/bar.c
Where 'path/to/sub' is a submodule, and therefore a foreign git repo to this one. Solving this is a little bit easier than your case because git is already running inside a repo. Extending the reach to submodules only requires more odb's than our first one to be considered. Along the way, I have considered your case, but I haven't focused on it. Lately I haven't had time to focus on my case either, though. :-\
Phil