You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Basin Ilya <ba...@gmail.com> on 2018/07/21 08:05:36 UTC

"scm:git:file:///" + repo.getAbsolutePath()

Hi.

I'm looking at the commits c7a9910 & 90089a7 in maven-scm. They create an instance of ScmRepository with

    "scm:git:file:///" + repo.getAbsolutePath()

Although the resulting string is further processed, before passed to git, it doesn't conform with the format documented in https://maven.apache.org/scm/git.html :

- Unneeded extra slash on Linux and Mac.
file:////home/blah means //home/blah and we're lucky that double slash doesn't have special meaning there.

- Unneeded extra slash on Windows
Both file:///C: and file://C: work with the Mingw git.

However, there's a serious problem with UNC paths. To be accepted by the Mingw Git, the path can be of three variants:

- file://localhost/c$/...
- 4 slashes: file:////localhost/c$/...
- 5 slashes: file://///localhost/c$/...

Plus, the path must not have backslashes at the beginning:

    C:\>git clone file:///\\localhost/c$/progs/maven/maven-scm/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/target/git_copy checkin-nobranch
    fatal: 'C:/localhost/c$/progs...

This can be remedied by replacing double backslash in the full scm URL that comes from pom.xml. Users shouldn't be obliged to do the replacement with e.g. build-helper:regex-property

So which variant is better? I think that if we ever want to fix SCM-815, then we must choose the one that is compatible with Cygwin, i.e. 4-slashes.

Also, the documented 2-slashes variant must also be recognized and converted to the 4-slashes before passed to git.exe.

As for non-UNC Cygwin paths, I think that we should't try to detect Cygwin. Instead, the users must configure their Cygwin Git to recognize Mingw-style urls:

    git config --global \
      url.file:///cygdrive/c.insteadOf \
      file:///C: file:///C:
    
    git config --global \
      url.file:///cygdrive/c.insteadOf \
      file://C: file://C:

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: "scm:git:file:///" + repo.getAbsolutePath()

Posted by Basin Ilya <ba...@gmail.com>.
I've just found that git ignores the ://host/ part.

21.07.2018 13:46, Michael Osipov пишет:
> Am 2018-07-21 um 10:05 schrieb Basin Ilya:
>> Hi.
>>
>> I'm looking at the commits c7a9910 & 90089a7 in maven-scm. They create an instance of ScmRepository with
>>
>>      "scm:git:file:///" + repo.getAbsolutePath()
>>
>> Although the resulting string is further processed, before passed to git, it doesn't conform with the format documented in https://maven.apache.org/scm/git.html :
>>
>> - Unneeded extra slash on Linux and Mac.
>> file:////home/blah means //home/blah and we're lucky that double slash doesn't have special meaning there.
>>
>> - Unneeded extra slash on Windows
>> Both file:///C: and file://C: work with the Mingw git.
>>
>> However, there's a serious problem with UNC paths. To be accepted by the Mingw Git, the path can be of three variants:
>>
>> - file://localhost/c$/...
>> - 4 slashes: file:////localhost/c$/...
>> - 5 slashes: file://///localhost/c$/...
>>
>> Plus, the path must not have backslashes at the beginning:
>>
>>      C:\>git clone file:///\\localhost/c$/progs/maven/maven-scm/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/target/git_copy checkin-nobranch
>>      fatal: 'C:/localhost/c$/progs...
>>
>> This can be remedied by replacing double backslash in the full scm URL that comes from pom.xml. Users shouldn't be obliged to do the replacement with e.g. build-helper:regex-property
>>
>> So which variant is better? I think that if we ever want to fix SCM-815, then we must choose the one that is compatible with Cygwin, i.e. 4-slashes.
>>
>> Also, the documented 2-slashes variant must also be recognized and converted to the 4-slashes before passed to git.exe.
>>
>> As for non-UNC Cygwin paths, I think that we should't try to detect Cygwin. Instead, the users must configure their Cygwin Git to recognize Mingw-style urls:
>>
>>      git config --global \
>>        url.file:///cygdrive/c.insteadOf \
>>        file:///C: file:///C:
>>           git config --global \
>>        url.file:///cygdrive/c.insteadOf \
>>        file://C: file://C:
> 
> The entire URI processing is SCM is old and brittle. Many times it does not adhere to RFC 3986.
> 
> I think it needs a compete rewrite not on top of java.net.URI.
> 
> Michael

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: "scm:git:file:///" + repo.getAbsolutePath()

Posted by Michael Osipov <mi...@apache.org>.
Am 2018-07-21 um 10:05 schrieb Basin Ilya:
> Hi.
> 
> I'm looking at the commits c7a9910 & 90089a7 in maven-scm. They create an instance of ScmRepository with
> 
>      "scm:git:file:///" + repo.getAbsolutePath()
> 
> Although the resulting string is further processed, before passed to git, it doesn't conform with the format documented in https://maven.apache.org/scm/git.html :
> 
> - Unneeded extra slash on Linux and Mac.
> file:////home/blah means //home/blah and we're lucky that double slash doesn't have special meaning there.
> 
> - Unneeded extra slash on Windows
> Both file:///C: and file://C: work with the Mingw git.
> 
> However, there's a serious problem with UNC paths. To be accepted by the Mingw Git, the path can be of three variants:
> 
> - file://localhost/c$/...
> - 4 slashes: file:////localhost/c$/...
> - 5 slashes: file://///localhost/c$/...
> 
> Plus, the path must not have backslashes at the beginning:
> 
>      C:\>git clone file:///\\localhost/c$/progs/maven/maven-scm/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/target/git_copy checkin-nobranch
>      fatal: 'C:/localhost/c$/progs...
> 
> This can be remedied by replacing double backslash in the full scm URL that comes from pom.xml. Users shouldn't be obliged to do the replacement with e.g. build-helper:regex-property
> 
> So which variant is better? I think that if we ever want to fix SCM-815, then we must choose the one that is compatible with Cygwin, i.e. 4-slashes.
> 
> Also, the documented 2-slashes variant must also be recognized and converted to the 4-slashes before passed to git.exe.
> 
> As for non-UNC Cygwin paths, I think that we should't try to detect Cygwin. Instead, the users must configure their Cygwin Git to recognize Mingw-style urls:
> 
>      git config --global \
>        url.file:///cygdrive/c.insteadOf \
>        file:///C: file:///C:
>      
>      git config --global \
>        url.file:///cygdrive/c.insteadOf \
>        file://C: file://C:

The entire URI processing is SCM is old and brittle. Many times it does 
not adhere to RFC 3986.

I think it needs a compete rewrite not on top of java.net.URI.

Michael

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org