* git clone does not understand insteadOf URLs
@ 2013-05-25 20:23 Gioele Barabucci
2013-05-26 15:13 ` Elia Pinto
0 siblings, 1 reply; 10+ messages in thread
From: Gioele Barabucci @ 2013-05-25 20:23 UTC (permalink / raw)
To: git
Hello,
it seems that `git clone` does not understand keywords used `insteadOf`
longer URLs.
$ git clone remote-repo/ProjectA.git
fatal repository 'remote-repo/ProjectA.git' does not exist
I suppose that git interprets the argument as a local directory. Git
should see if the argument matches one of the known URLs before raising
an error.
Regards,
--
Gioele Barabucci <gioele@svario.it>
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: git clone does not understand insteadOf URLs
2013-05-25 20:23 git clone does not understand insteadOf URLs Gioele Barabucci
@ 2013-05-26 15:13 ` Elia Pinto
2013-05-26 17:55 ` Gioele Barabucci
0 siblings, 1 reply; 10+ messages in thread
From: Elia Pinto @ 2013-05-26 15:13 UTC (permalink / raw)
To: Gioele Barabucci, git
Why someone should be do something like this ? What is the use case ?
Best regards
2013/5/25, Gioele Barabucci <gioele@svario.it>:
> Hello,
>
> it seems that `git clone` does not understand keywords used `insteadOf`
> longer URLs.
>
> $ git clone remote-repo/ProjectA.git
> fatal repository 'remote-repo/ProjectA.git' does not exist
>
> I suppose that git interprets the argument as a local directory. Git
> should see if the argument matches one of the known URLs before raising
> an error.
>
> Regards,
>
> --
> Gioele Barabucci <gioele@svario.it>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Inviato dal mio dispositivo mobile
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: git clone does not understand insteadOf URLs
2013-05-26 15:13 ` Elia Pinto
@ 2013-05-26 17:55 ` Gioele Barabucci
2013-05-26 18:00 ` Andreas Schwab
0 siblings, 1 reply; 10+ messages in thread
From: Gioele Barabucci @ 2013-05-26 17:55 UTC (permalink / raw)
To: Elia Pinto; +Cc: git
Il 26/05/2013 17:13, Elia Pinto ha scritto:
>> $ git clone remote-repo/ProjectA.git
>> fatal repository 'remote-repo/ProjectA.git' does not exist
>
> Why someone should be do something like this ? What is the use case ?
Simple, I keep all my projects on the same server, so I would like to
refer to that server + path using 'remote-repo'.
"git+ssh://git.example.org//users/gioele/projects" insteadOf "remote-repo"
I also helps me when I move all the projects from one path to another in
the remote server: I only need to change the path once in `~/.gitconfig`.
Please note that `git remote add` correctly understands
'remote-repo/ProjectA.git'. I was expecting that `clone` and `remote`
both used the same code to parse paths.
Regards,
--
Gioele Barabucci <gioele@svario.it>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: git clone does not understand insteadOf URLs
2013-05-26 17:55 ` Gioele Barabucci
@ 2013-05-26 18:00 ` Andreas Schwab
2013-05-26 18:09 ` Gioele Barabucci
2013-05-28 20:06 ` Junio C Hamano
0 siblings, 2 replies; 10+ messages in thread
From: Andreas Schwab @ 2013-05-26 18:00 UTC (permalink / raw)
To: Gioele Barabucci; +Cc: Elia Pinto, git
Gioele Barabucci <gioele@svario.it> writes:
> Simple, I keep all my projects on the same server, so I would like to
> refer to that server + path using 'remote-repo'.
>
> "git+ssh://git.example.org//users/gioele/projects" insteadOf "remote-repo"
You can use "remote-repo:" instead.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: git clone does not understand insteadOf URLs
2013-05-26 18:00 ` Andreas Schwab
@ 2013-05-26 18:09 ` Gioele Barabucci
2013-05-26 18:14 ` John Keeping
2013-05-28 20:06 ` Junio C Hamano
1 sibling, 1 reply; 10+ messages in thread
From: Gioele Barabucci @ 2013-05-26 18:09 UTC (permalink / raw)
To: Andreas Schwab; +Cc: Elia Pinto, git
Il 26/05/2013 20:00, Andreas Schwab ha scritto:
>> Simple, I keep all my projects on the same server, so I would like to
>> refer to that server + path using 'remote-repo'.
>>
>> "git+ssh://git.example.org//users/gioele/projects" insteadOf "remote-repo"
>
> You can use "remote-repo:" instead.
Do you mean I could use
"git+ssh://git.example.org//users/gioele/projects" insteadOf
"remote-repo:"? Yes, but now I have dozens of repositories already set
up in various workstations and I do not want to go and change all of them.
What really bugs me is the fact that `git clone` and `git remote add`
parse the same path in different ways. Git already has many
inconsistencies. This one can be easily ironed out.
Regards,
--
Gioele Barabucci <gioele@svario.it>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: git clone does not understand insteadOf URLs
2013-05-26 18:09 ` Gioele Barabucci
@ 2013-05-26 18:14 ` John Keeping
2013-05-26 18:21 ` Gioele Barabucci
0 siblings, 1 reply; 10+ messages in thread
From: John Keeping @ 2013-05-26 18:14 UTC (permalink / raw)
To: Gioele Barabucci; +Cc: Andreas Schwab, Elia Pinto, git
On Sun, May 26, 2013 at 08:09:56PM +0200, Gioele Barabucci wrote:
> Il 26/05/2013 20:00, Andreas Schwab ha scritto:
> >> Simple, I keep all my projects on the same server, so I would like to
> >> refer to that server + path using 'remote-repo'.
> >>
> >> "git+ssh://git.example.org//users/gioele/projects" insteadOf "remote-repo"
> >
> > You can use "remote-repo:" instead.
>
> Do you mean I could use
> "git+ssh://git.example.org//users/gioele/projects" insteadOf
> "remote-repo:"? Yes, but now I have dozens of repositories already set
> up in various workstations and I do not want to go and change all of them.
>
> What really bugs me is the fact that `git clone` and `git remote add`
> parse the same path in different ways. Git already has many
> inconsistencies. This one can be easily ironed out.
In what way do you think that `git remote add` handles the path?
All `git remote add` does is add a new "remote.<name>.url" entry to the
configuration file with the value as given on the command line. The
insteadOf mapping will only be applied when you try to fetch from/push
to the remote.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: git clone does not understand insteadOf URLs
2013-05-26 18:14 ` John Keeping
@ 2013-05-26 18:21 ` Gioele Barabucci
2013-05-26 19:00 ` John Keeping
0 siblings, 1 reply; 10+ messages in thread
From: Gioele Barabucci @ 2013-05-26 18:21 UTC (permalink / raw)
To: John Keeping; +Cc: Andreas Schwab, Elia Pinto, git
Il 26/05/2013 20:14, John Keeping ha scritto:
> On Sun, May 26, 2013 at 08:09:56PM +0200, Gioele Barabucci wrote:
>> Il 26/05/2013 20:00, Andreas Schwab ha scritto:
>>>> Simple, I keep all my projects on the same server, so I would like to
>>>> refer to that server + path using 'remote-repo'.
>>>>
>>>> "git+ssh://git.example.org//users/gioele/projects" insteadOf "remote-repo"
>
> In what way do you think that `git remote add` handles the path?
>
> All `git remote add` does is add a new "remote.<name>.url" entry to the
> configuration file with the value as given on the command line. The
> insteadOf mapping will only be applied when you try to fetch from/push
> to the remote.
Regardless of the implementation of the commands, if I do
mkdir projectA
cd projectA
git init .
git remote add origin remote-repo/projectA.git
git pull origin master
I get a working repository. If I do
git clone remote-repo/projectA.git
all I will get is an error.
I do not see any reason (UX-wise) why the two sequences of commands
shouldn't work the same when used on the same URL.
Regards,
--
Gioele Barabucci <gioele@svario.it>
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: git clone does not understand insteadOf URLs
2013-05-26 18:21 ` Gioele Barabucci
@ 2013-05-26 19:00 ` John Keeping
2013-05-26 19:03 ` Gioele Barabucci
0 siblings, 1 reply; 10+ messages in thread
From: John Keeping @ 2013-05-26 19:00 UTC (permalink / raw)
To: Gioele Barabucci; +Cc: Andreas Schwab, Elia Pinto, git
On Sun, May 26, 2013 at 08:21:45PM +0200, Gioele Barabucci wrote:
> Il 26/05/2013 20:14, John Keeping ha scritto:
> > On Sun, May 26, 2013 at 08:09:56PM +0200, Gioele Barabucci wrote:
> >> Il 26/05/2013 20:00, Andreas Schwab ha scritto:
> >>>> Simple, I keep all my projects on the same server, so I would like to
> >>>> refer to that server + path using 'remote-repo'.
> >>>>
> >>>> "git+ssh://git.example.org//users/gioele/projects" insteadOf "remote-repo"
> >
> > In what way do you think that `git remote add` handles the path?
> >
> > All `git remote add` does is add a new "remote.<name>.url" entry to the
> > configuration file with the value as given on the command line. The
> > insteadOf mapping will only be applied when you try to fetch from/push
> > to the remote.
>
> Regardless of the implementation of the commands, if I do
>
> mkdir projectA
> cd projectA
> git init .
> git remote add origin remote-repo/projectA.git
> git pull origin master
>
> I get a working repository. If I do
>
> git clone remote-repo/projectA.git
>
> all I will get is an error.
So the problem is that "git clone" does not seem to perform normal
remote processing if you give it something that looks like a path.
More specifically, it looks like the problem is that if you give clone
something that does not contain a colon (':') it considers it to be a
local path and dies if that path does not exist. Adding a colon as
Andreas suggested makes it look like a remote URL so it will be handled
correctly.
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: git clone does not understand insteadOf URLs
2013-05-26 19:00 ` John Keeping
@ 2013-05-26 19:03 ` Gioele Barabucci
0 siblings, 0 replies; 10+ messages in thread
From: Gioele Barabucci @ 2013-05-26 19:03 UTC (permalink / raw)
To: John Keeping; +Cc: Andreas Schwab, Elia Pinto, git
Il 26/05/2013 21:00, John Keeping ha scritto:
>> Regardless of the implementation of the commands, if I do
>>
>> mkdir projectA
>> cd projectA
>> git init .
>> git remote add origin remote-repo/projectA.git
>> git pull origin master
>>
>> I get a working repository. If I do
>>
>> git clone remote-repo/projectA.git
>>
>> all I will get is an error.
>
> So the problem is that "git clone" does not seem to perform normal
> remote processing if you give it something that looks like a path.
I understand the problem. In the original email that started this thread
I asked for...
> I suppose that git interprets the argument as a local directory. Git
> should see if the argument matches one of the known URLs before
> raising an error.
I think all the paths should mean the same in every git command. In this
case, checking for insteadOf URLs before failing would solve this problem.
Regards,
--
Gioele Barabucci <gioele@svario.it>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: git clone does not understand insteadOf URLs
2013-05-26 18:00 ` Andreas Schwab
2013-05-26 18:09 ` Gioele Barabucci
@ 2013-05-28 20:06 ` Junio C Hamano
1 sibling, 0 replies; 10+ messages in thread
From: Junio C Hamano @ 2013-05-28 20:06 UTC (permalink / raw)
To: Andreas Schwab; +Cc: Gioele Barabucci, Elia Pinto, git
Andreas Schwab <schwab@linux-m68k.org> writes:
> Gioele Barabucci <gioele@svario.it> writes:
>
>> Simple, I keep all my projects on the same server, so I would like to
>> refer to that server + path using 'remote-repo'.
>>
>> "git+ssh://git.example.org//users/gioele/projects" insteadOf "remote-repo"
>
> You can use "remote-repo:" instead.
That "with colon" is pretty much how it was designed to be used, but
the code did not insist that the insteadof has at least the scheme
part, and by mistake allowed something like this
[url "k.org:/pub/scm/git"] insteadOf = g
to be used with "g/foo" to expand to "k.org:/pub/scm/git/foo".
But if "git fetch g/foo" with such a configuration happily goes to
"k.org:/pub/scm/git/foo" without problems, then I think it is very
reasonable to delay the "is that a local filename?" short-cut "git
clone" does and let the insteadof URL expand take place before it.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2013-05-28 20:07 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-25 20:23 git clone does not understand insteadOf URLs Gioele Barabucci
2013-05-26 15:13 ` Elia Pinto
2013-05-26 17:55 ` Gioele Barabucci
2013-05-26 18:00 ` Andreas Schwab
2013-05-26 18:09 ` Gioele Barabucci
2013-05-26 18:14 ` John Keeping
2013-05-26 18:21 ` Gioele Barabucci
2013-05-26 19:00 ` John Keeping
2013-05-26 19:03 ` Gioele Barabucci
2013-05-28 20:06 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox