summaryrefslogtreecommitdiffstats
path: root/Documentation/CodingGuidelines
diff options
context:
space:
mode:
authorChristian Couder <christian.couder@gmail.com>2026-04-07 13:52:43 +0200
committerJunio C Hamano <gitster@pobox.com>2026-04-07 08:45:44 -0700
commit8eb863597f630efe08f96ed12f8defbe5a5f0b1d (patch)
tree61639ed0faea49e5333bc4270b61e3ba25d446b7 /Documentation/CodingGuidelines
parentd56e483b03bfe46340af5cdbcddec8858661d2e9 (diff)
downloadgit-8eb863597f630efe08f96ed12f8defbe5a5f0b1d.tar.gz
git-8eb863597f630efe08f96ed12f8defbe5a5f0b1d.zip
t5710: use proper file:// URIs for absolute paths
In t5710, we frequently construct local file URIs using `file://$(pwd)`. On Unix-like systems, $(pwd) returns an absolute path starting with a slash (e.g., `/tmp/repo`), resulting in a valid 3-slash URI with an empty host (`file:///tmp/repo`). However, on Windows, $(pwd) returns a path starting with a drive letter (e.g., `D:/a/repo`). This results in a 2-slash URI (`file://D:/a/repo`). Standard URI parsers misinterpret this format, treating `D:` as the host rather than part of the absolute path. This is to be expected because RFC 8089 says that the `//` prefix with an empty local host must be followed by an absolute path starting with a slash. While this hasn't broken the existing tests (because the old `promisor.acceptFromServer` logic relies entirely on strict `strcmp()` without normalizing the URLs), it will break future commits that pass these URLs through `url_normalize()` or similar functions. To future-proof the tests and ensure cross-platform URI compliance, let's introduce a $TRASH_DIRECTORY_URL helper variable that explicitly guarantees a leading slash for the path component, ensuring valid 3-slash `file:///` URIs on all operating systems. While at it, let's also introduce $ENCODED_TRASH_DIRECTORY_URL to handle some common special characters in directory paths. To be extra safe, let's skip all the tests if there are uncommon special characters in the directory path. Then let's replace all instances of `file://$(pwd)` with $TRASH_DIRECTORY_URL across the test script, and let's simplify the `sendFields` and `checkFields` tests to use $ENCODED_TRASH_DIRECTORY_URL directly. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/CodingGuidelines')
0 files changed, 0 insertions, 0 deletions