ingydotnet / git-subrepo

MIT License
3.27k stars 270 forks source link

`git subrepo pull` doesn't work when in the subrepo #1

Open kentfredric opened 10 years ago

kentfredric commented 10 years ago

git subrepo status however works.

And it seems intuitive that if that works, git subrepo pull should also.

ingydotnet commented 10 years ago

Currently all commands want you to be at the top level dir. I can make them work from anywhere, but want to wait until the dust settles. Still have a bit of refactoring to do.

ingydotnet commented 9 years ago

By 'in the subrepo' I assume you mean chdir'd into its subdir. Can you verify that?

Under the new code/doc 'being in the subrepo' means having its subrepo branch checkedout.

kentfredric commented 9 years ago

By 'in the subrepo' I assume you mean chdir'd into its subdir.

I believe so. Its been a while though.

But yes, it seems intuitive that if

/
/foo
/foo/bar
/foo/bar/baz

If "foo" here is a subrepo graft point, then git subrepo <whatever> at any of foo|foo/bar|foo/bar/baz will automatically imply that as its context.

ingydotnet commented 9 years ago

Currently you can only issue subrepo commands from the top level repo dir. It will simply tell you that if you try to.

Obviously this needs to be fixed. It was just the easiest way to get things working. Once they stabilize I can add this. (Soon now!).

So the problem is that all the commands except clone, that a name as the name of the subrepo. This works well from the top level as you can tab complete it. I strip off the final '/', so it works.

ie if I have:

./.git/
./ReadMe
./foo/bar/.gitrepo
./bar/.gitrepo

then I have 2 subrepos whose names are 'foo/bar' and 'bar'. I can:

git subrepo pull foo/bar/    # tab completed

and that works.

If I:

cd foo/
git subrepo pull bar

what does that mean. I contend it means the top level ./bar/, since 'bar' is the subrepo's name.

There's 2 outs here:

1) Only worry when ambiguous and ask. 2) Support:

cd foo/
git subrepo pull ./bar/   # means the foo/bar subrepo

3) Do both. :)

But you should be able to do:

git subrepo pull foo/bar

from any subdirectory.

I'll work on it soon after the remix stabilizes.