-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Git Clone with 'file://' URLs Not Handled Properly #1264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think there's a missing For example, this works for me from Git Bash:
|
My understanding of the file:// standard is that file://host/filepath is the standard form for non local files. The part after file:// should denote the server, and in the local case it is null, hence file:///path/to/file. See Section 3.10 https://www.ietf.org/rfc/rfc1738.txt Either way, the 'C:\Program Files\Git' behavior seems like a bug? I've never run personally across the 'file:////' style UNC paths before, but it looks like the format you suggest is mentioned in a few places, and may be an alternative standard. For example https://tools.ietf.org/html/draft-hoffman-file-uri-03. This syntax works for me as a workaround, thanks for the tip! Also, technically your example should contain a third slash... Although having it work without the third slash is a good thing for usability. :)
|
The syntax The syntax for UNC path needs 4 slashes: And this is even suggested by a newer RFC: |
Thanks for the help! I'm not blocked by this, I have converted a few URIs to file://// format, and everything works for me. Not to get into a bug/feature war here... But I do think this is a bug. Git is non-compliant with part of the RFC standard. If this is a 'Won't Fix' issue, that is fine but I it should be called out somewhere in the form of a bug (here) or mentioned in the docs. |
@tboegi @jgehrig if we can confirm this is also reproducible on non-Windows versions of Git, then it's a discussion that needs to be moved over to the Git mailing list. |
The Git documentation says:
So UNC path names are not mentioned at all. If someone wants to send a patch: This is welcome |
This is not a WontFix issue, but it definitely shows once again that Git for Windows is not suffering a shortage of feature requests, but a shortage of volunteers to contribute improvements. @jgehrig please take this as an encouragement to work on a fix. I guess the best place to start would be here: https://github.com/git-for-windows/git/blob/v2.14.1.windows.1/connect.c#L616-L683 (most likely including the host part with two leading slashes in the returned path whenever appropriate). |
More by accident: I found an old patch, which I paste in here. commit d15e461708eb844002b24b29a2a2c95997ae0b93 (HEAD -> tb.160815-connect-UNC)
diff --git a/connect.c b/connect.c
index e78d3f43d8..b0947933c4 100644
--- a/connect.c
+++ b/connect.c
@@ -647,6 +647,8 @@ static enum protocol parse_connect_url(const char *url_orig, char **ret_host,
if (protocol == PROTO_LOCAL)
path = end;
+ else if (protocol == PROTO_FILE && (offset_1st_component(host-2) >=2))
+ path = host - 2; /* include the leading "//" */
else if (protocol == PROTO_FILE && has_dos_drive_prefix(end))
path = end; /* "file://$(pwd)" may be "file://C:/projects/repo" */
else
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
index 80a1a3239a..686c3a15a0 100755
--- a/t/t5500-fetch-pack.sh
+++ b/t/t5500-fetch-pack.sh
@@ -647,9 +647,12 @@ do
# file with scheme
for p in file
do
- test_expect_success "fetch-pack --diag-url $p://$h/$r" '
+ test_expect_success !MINGW "fetch-pack --diag-url $p://$h/$r" '
check_prot_path $p://$h/$r $p "/$r"
'
+ test_expect_success MINGW "fetch-pack --diag-url $p://$h/$r" '
+ check_prot_path $p://$h/$r $p "//$h/$r"
+ '
# No "/~" -> "~" conversion for file
test_expect_success "fetch-pack --diag-url $p://$h/~$r" '
check_prot_path $p://$h/~$r $p "/~$r" |
Thanks, @tboegi! |
Extend the parser to accept file://server/share/repo in the way that Windows users expect it to be parsed who are used to referring to file shares by UNC paths of the form \\server\share\folder. [jes: tightened check to avoid handling file://C:/some/path as a UNC path.] This closes #1264. Signed-off-by: Torsten Bögershausen <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
Extend the parser to accept file://server/share/repo in the way that Windows users expect it to be parsed who are used to referring to file shares by UNC paths of the form \\server\share\folder. [jes: tightened check to avoid handling file://C:/some/path as a UNC path.] This closes #1264. Signed-off-by: Torsten Bögershausen <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
Extend the parser to accept file://server/share/repo in the way that Windows users expect it to be parsed who are used to referring to file shares by UNC paths of the form \\server\share\folder. [jes: tightened check to avoid handling file://C:/some/path as a UNC path.] This closes #1264. Signed-off-by: Torsten Bögershausen <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
Extend the parser to accept file://server/share/repo in the way that Windows users expect it to be parsed who are used to referring to file shares by UNC paths of the form \\server\share\folder. [jes: tightened check to avoid handling file://C:/some/path as a UNC path.] This closes #1264. Signed-off-by: Torsten Bögershausen <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
Extend the parser to accept file://server/share/repo in the way that Windows users expect it to be parsed who are used to referring to file shares by UNC paths of the form \\server\share\folder. [jes: tightened check to avoid handling file://C:/some/path as a UNC path.] This closes #1264. Signed-off-by: Torsten Bögershausen <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
Extend the parser to accept file://server/share/repo in the way that Windows users expect it to be parsed who are used to referring to file shares by UNC paths of the form \\server\share\folder. [jes: tightened check to avoid handling file://C:/some/path as a UNC path.] This closes #1264. Signed-off-by: Torsten Bögershausen <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
Extend the parser to accept file://server/share/repo in the way that Windows users expect it to be parsed who are used to referring to file shares by UNC paths of the form \\server\share\folder. [jes: tightened check to avoid handling file://C:/some/path as a UNC path.] This closes #1264. Signed-off-by: Torsten Bögershausen <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
Extend the parser to accept file://server/share/repo in the way that Windows users expect it to be parsed who are used to referring to file shares by UNC paths of the form \\server\share\folder. [jes: tightened check to avoid handling file://C:/some/path as a UNC path.] This closes #1264. Signed-off-by: Torsten Bögershausen <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
Extend the parser to accept file://server/share/repo in the way that Windows users expect it to be parsed who are used to referring to file shares by UNC paths of the form \\server\share\folder. [jes: tightened check to avoid handling file://C:/some/path as a UNC path.] This closes #1264. Signed-off-by: Torsten Bögershausen <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
Extend the parser to accept file://server/share/repo in the way that Windows users expect it to be parsed who are used to referring to file shares by UNC paths of the form \\server\share\folder. [jes: tightened check to avoid handling file://C:/some/path as a UNC path.] This closes #1264. Signed-off-by: Torsten Bögershausen <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
Extend the parser to accept file://server/share/repo in the way that Windows users expect it to be parsed who are used to referring to file shares by UNC paths of the form \\server\share\folder. [jes: tightened check to avoid handling file://C:/some/path as a UNC path.] This closes #1264. Signed-off-by: Torsten Bögershausen <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
Extend the parser to accept file://server/share/repo in the way that Windows users expect it to be parsed who are used to referring to file shares by UNC paths of the form \\server\share\folder. [jes: tightened check to avoid handling file://C:/some/path as a UNC path.] This closes #1264. Signed-off-by: Torsten Bögershausen <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
Extend the parser to accept file://server/share/repo in the way that Windows users expect it to be parsed who are used to referring to file shares by UNC paths of the form \\server\share\folder. [jes: tightened check to avoid handling file://C:/some/path as a UNC path.] This closes #1264. Signed-off-by: Torsten Bögershausen <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
Extend the parser to accept file://server/share/repo in the way that Windows users expect it to be parsed who are used to referring to file shares by UNC paths of the form \\server\share\folder. [jes: tightened check to avoid handling file://C:/some/path as a UNC path.] This closes #1264. Signed-off-by: Torsten Bögershausen <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
Extend the parser to accept file://server/share/repo in the way that Windows users expect it to be parsed who are used to referring to file shares by UNC paths of the form \\server\share\folder. [jes: tightened check to avoid handling file://C:/some/path as a UNC path.] This closes #1264. Signed-off-by: Torsten Bögershausen <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
Extend the parser to accept file://server/share/repo in the way that Windows users expect it to be parsed who are used to referring to file shares by UNC paths of the form \\server\share\folder. [jes: tightened check to avoid handling file://C:/some/path as a UNC path.] This closes #1264. Signed-off-by: Torsten Bögershausen <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
Extend the parser to accept file://server/share/repo in the way that Windows users expect it to be parsed who are used to referring to file shares by UNC paths of the form \\server\share\folder. [jes: tightened check to avoid handling file://C:/some/path as a UNC path.] This closes #1264. Signed-off-by: Torsten Bögershausen <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
Extend the parser to accept file://server/share/repo in the way that Windows users expect it to be parsed who are used to referring to file shares by UNC paths of the form \\server\share\folder. [jes: tightened check to avoid handling file://C:/some/path as a UNC path.] This closes #1264. Signed-off-by: Torsten Bögershausen <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
Extend the parser to accept file://server/share/repo in the way that Windows users expect it to be parsed who are used to referring to file shares by UNC paths of the form \\server\share\folder. [jes: tightened check to avoid handling file://C:/some/path as a UNC path.] This closes #1264. Signed-off-by: Torsten Bögershausen <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
Extend the parser to accept file://server/share/repo in the way that Windows users expect it to be parsed who are used to referring to file shares by UNC paths of the form \\server\share\folder. [jes: tightened check to avoid handling file://C:/some/path as a UNC path.] This closes #1264. Signed-off-by: Torsten Bögershausen <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
Extend the parser to accept file://server/share/repo in the way that Windows users expect it to be parsed who are used to referring to file shares by UNC paths of the form \\server\share\folder. [jes: tightened check to avoid handling file://C:/some/path as a UNC path.] This closes #1264. Signed-off-by: Torsten Bögershausen <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
Extend the parser to accept file://server/share/repo in the way that Windows users expect it to be parsed who are used to referring to file shares by UNC paths of the form \\server\share\folder. [jes: tightened check to avoid handling file://C:/some/path as a UNC path.] This closes #1264. Signed-off-by: Torsten Bögershausen <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
Extend the parser to accept file://server/share/repo in the way that Windows users expect it to be parsed who are used to referring to file shares by UNC paths of the form \\server\share\folder. [jes: tightened check to avoid handling file://C:/some/path as a UNC path.] This closes #1264. Signed-off-by: Torsten Bögershausen <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
Extend the parser to accept file://server/share/repo in the way that Windows users expect it to be parsed who are used to referring to file shares by UNC paths of the form \\server\share\folder. [jes: tightened check to avoid handling file://C:/some/path as a UNC path.] This closes #1264. Signed-off-by: Torsten Bögershausen <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
Extend the parser to accept file://server/share/repo in the way that Windows users expect it to be parsed who are used to referring to file shares by UNC paths of the form \\server\share\folder. [jes: tightened check to avoid handling file://C:/some/path as a UNC path.] This closes #1264. Signed-off-by: Torsten Bögershausen <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
Extend the parser to accept file://server/share/repo in the way that Windows users expect it to be parsed who are used to referring to file shares by UNC paths of the form \\server\share\folder. [jes: tightened check to avoid handling file://C:/some/path as a UNC path.] This closes #1264. Signed-off-by: Torsten Bögershausen <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
Extend the parser to accept file://server/share/repo in the way that Windows users expect it to be parsed who are used to referring to file shares by UNC paths of the form \\server\share\folder. [jes: tightened check to avoid handling file://C:/some/path as a UNC path.] This closes #1264. Signed-off-by: Torsten Bögershausen <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
Extend the parser to accept file://server/share/repo in the way that Windows users expect it to be parsed who are used to referring to file shares by UNC paths of the form \\server\share\folder. [jes: tightened check to avoid handling file://C:/some/path as a UNC path.] This closes #1264. Signed-off-by: Torsten Bögershausen <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
Extend the parser to accept file://server/share/repo in the way that Windows users expect it to be parsed who are used to referring to file shares by UNC paths of the form \\server\share\folder. [jes: tightened check to avoid handling file://C:/some/path as a UNC path.] This closes #1264. Signed-off-by: Torsten Bögershausen <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
Extend the parser to accept file://server/share/repo in the way that Windows users expect it to be parsed who are used to referring to file shares by UNC paths of the form \\server\share\folder. [jes: tightened check to avoid handling file://C:/some/path as a UNC path.] This closes #1264. Signed-off-by: Torsten Bögershausen <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
Extend the parser to accept file://server/share/repo in the way that Windows users expect it to be parsed who are used to referring to file shares by UNC paths of the form \\server\share\folder. [jes: tightened check to avoid handling file://C:/some/path as a UNC path.] This closes #1264. Signed-off-by: Torsten Bögershausen <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
Setup
Windows 10 64-bit
defaults?
to the issue you're seeing?
Its not Linux? :(
Details
ConEmu/cmd.exe
Minimal, Complete, and Verifiable example
this will help us understand the issue.
Git should clone the files from \\servername\file\path\here
Git tries (and fails) to clone from C:\Program Files\Git\file\path\here
URL to that repository to help us with testing?
This issue repros with any type of file:// style network path.
I can get this to work (manually) by using the syntax "git clone //servername/file/path/here", so this seems like an URL parsing error.
The text was updated successfully, but these errors were encountered: