From: Christian Couder Date: Thu, 02 Apr 2026 06:36:26 GMT Subject: Re: [PATCH 12/16] t5710: use proper file:// URIs for absolute paths Message-ID: In-Reply-To: On Thu, Mar 26, 2026 at 1:21 PM Patrick Steinhardt wrote: > > On Mon, Mar 23, 2026 at 09:05:15AM +0100, Christian Couder wrote: > > diff --git a/t/t5710-promisor-remote-capability.sh b/t/t5710-promisor-remote-capability.sh > > index 357822c01a..c7a484228f 100755 > > --- a/t/t5710-promisor-remote-capability.sh > > +++ b/t/t5710-promisor-remote-capability.sh > > @@ -76,6 +76,17 @@ copy_to_lop () { > > cp "$path" "$path2" > > } > > > > +# On Windows, 'pwd' returns a path like 'D:/foo/bar'. Prepend '/' to turn > > +# it into '/D:/foo/bar', which is what git expects in file:// URLs on Windows. > > +# On Unix, the path already starts with '/', so this is a no-op. > > +pwd_path=$(pwd) > > +case "$pwd_path" in > > +[a-zA-Z]:*) pwd_path="/$pwd_path" ;; > > +esac > > +PWD_URL="file://$pwd_path" > > +# Same as PWD_URL but with spaces percent-encoded, for use in URL patterns. > > +ENCODED_PWD_URL="file://$(echo "$pwd_path" | sed "s/ /%20/g")" > > Can't we do this unconditionally on all platforms? "file:////foobar" > should be valid on Unix systems, too, shouldn't it? It depends what you mean by "valid". Perhaps it works and would simplify this code a bit, but I think the standard is 'RFC 8089: The "file" URI Scheme' which seems to says that the `//` prefix with an empty local host must be followed by an absolute path starting with a slash, resulting in exactly 3 slashes (file:///foobar). (See: https://www.rfc-editor.org/rfc/rfc8089#section-2) Appendix E.2 of RFC 8089 also seems to say that `file:///c:/path/to/file` is the standard representation for Windows drive letters. So it seems safer to follow that standard in our parsers and tests, as we could then refer users to the standard and possibly make our parsers strictly follow it and test them against it in the future.