threads / bug / 60382

Git Pathspec bug

Subject: Git Pathspec bug

## tl;dr

3 messages between Oct 17, 2023 and Oct 17, 2023.

replies: 2people: 3as markdown or json

Moritz Widmann· Oct 17, 2023, 09:45 UTC · lore

I executed the following command in zsh (added `command` just to be sure that there's no aliases or functions)

command git submodule add 'git@github.com:moritz-t-w/Godot-Onscreen-Keyboard.git' '.' fatal: empty string is not a valid pathspec. please use . instead if you meant to match all paths

Git Version: 2.42.0
OS: Arch Linux
Kristoffer Haugsbakk· Oct 17, 2023, 10:51 UTC · re: Moritz Widmann · lore

Re: Git Pathspec bug

On Tue, Oct 17, 2023, at 11:45, Moritz Widmann wrote:
Show 11 quoted lines
> I executed the following command in zsh (added `command` just to be sure 
> that there's no aliases or functions)
>
> command git submodule add 
> 'git@github.com:moritz-t-w/Godot-Onscreen-Keyboard.git' '.'
> fatal: empty string is not a valid pathspec. please use . instead if you 
> meant to match all paths
>
> Git Version: 2.42.0
>
> OS: Arch Linux
Is this the same issue?: https://stackoverflow.com/a/53441183/1725151
Junio C Hamano· Oct 17, 2023, 16:02 UTC · re: Kristoffer Haugsbakk · lore

Re: Git Pathspec bug

"Kristoffer Haugsbakk" <code@khaugsbakk.name> writes:
Show 14 quoted lines
> On Tue, Oct 17, 2023, at 11:45, Moritz Widmann wrote:
>> I executed the following command in zsh (added `command` just to be sure 
>> that there's no aliases or functions)
>>
>> command git submodule add 
>> 'git@github.com:moritz-t-w/Godot-Onscreen-Keyboard.git' '.'
>> fatal: empty string is not a valid pathspec. please use . instead if you 
>> meant to match all paths
>>
>> Git Version: 2.42.0
>>
>> OS: Arch Linux
>
> Is this the same issue?: https://stackoverflow.com/a/53441183/1725151
It does look so.

It is correct to reject such a request to attempt to add a submodule as if it is overlayed at the same level as its superproject [*]. But the error message is totally bogus, I think. It is not that the pathspec the end-user gave us is wrong (the user does not even give a pathspec in this case---the last one must be a concrete path in the superproject where the newly added submodule is), and the user should not be told anything about "valid" pathspec.

Patches welcome ;-)
Thanks.
[Footnote]
* Our submodules do not allow such a layout (and "git add foo" in
  such an environment would not know to which repository between the
  submodule or the superproject that new file "foo" should be added,
  which is just one example why such a layout is not usable).

← back to recent threads