Allow git submodule add in subdirectory of the working tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi everyone,

I just stumbled upon a weird limitation that I think doesn't make sense.
Submodules with relative remote paths are allowed when added from the
root of the working tree, but not allowed when added within a
subdirectory. Always having to cd to the root directory first and then
having to specify the full path where the submodule should reside, is
not a huge limitation but I don't think it's neccessary. Or am I missing
something? See my bug report created with git bugreport.

Please include me in CC in replies to this message, as this is the first
time I'm posting to this list and I haven't subscribed yet.

What did you do before the bug happened? (Steps to reproduce your issue)
Run `git submodule add ../foo` with a relative remote path (`../foo`) in
a subdirectory (`bar/`) of the current git tree.

What did you expect to happen? (Expected behavior)
The submodule `foo` gets added under `bar/foo` with remote `../foo`.

What happened instead? (Actual behavior)
An error message occured: `Relative path can only be used from the
toplevel of the working tree`

What's different between what you expected and what actually happened?
The git cli didn't allow to use the relative remote path for the
submodule in a subdirectory of the current git tree, although running
`git submodule add ../foo` under `/bar` is equal to running `git
submodule add ../foo bar/foo` from the root level directory of the
current git tree. The second version is allowed, the first one isn't,
although both are equivalent.

Anything else you want to add:
I think that it doesn't make sense to forbid a relative remote path on a
subdirectory of the git tree. Relative remotes are a crucial feature if
you don't want to specify the protocol to use to fetch the submodule
(some people working on the same repository use HTTPS, others use SSH,
in both cases the preferred method should be used to fetch the
submodule). Having to add all submodules from the top level directory is
a limitation that I think isn't neccessary.

Please review the rest of the bug report below.
You can delete any lines you don't wish to share.


[System Info]
git version:
git version 2.28.0
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Linux 5.8.12-arch1-1 #1 SMP PREEMPT Sat, 26 Sep 2020 21:42:58
+0000 x86_64
compiler info: gnuc: 10.1
libc info: glibc: 2.32
$SHELL (typically, interactive shell): /bin/bash


[Enabled Hooks]

Thanks,
LuKaRo

Attachment: 0xB0030EE50DD3C616.asc
Description: application/pgp-keys

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux