Skip to content

Commit 695f825

Browse files
committed
Improve messages about joining C: on the right
Although the path `C:` is relative because it indicates the current directory on the C: drive, it still "takes over" when concatenated after at most if not all paths (including absolute paths). When the paths it is concatenated with are absolute paths with drive letters other than C:, this behavior, while not obvious, is conceptually clear such that no other behavior could be correct. This is because the (drive-specific) current directory on the C: drive is not located on another drive, and therefore not found under any path that specifies a drive that is not C:. (There are other situations where `C:` on the right takes precedence where the explanation is less elegant, but they are mostly not relevant to the assertions currently present here.) This relates to: - https://github.com/Byron/gitoxide/pull/1374/files/e955770c0b5c06a6c8518a06df4aa0cc3b506f16#r1721055278 - https://github.com/Byron/gitoxide/pull/1374/files/e955770c0b5c06a6c8518a06df4aa0cc3b506f16#r1721079186
1 parent a11fe15 commit 695f825

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

gix-fs/tests/stack/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ fn path_join_handling() {
9292
assert_eq!(
9393
p("d:/").join("C:"),
9494
p("C:"),
95-
"d-drive + c-drive = c-drive - interesting, as C: is supposed to be relative"
95+
"d-drive + c-drive-relative = c-drive-relative - C: is relative but not on D:"
9696
);
9797
assert_eq!(
9898
p("d:\\").join("C:\\"),
@@ -113,7 +113,7 @@ fn path_join_handling() {
113113
assert_eq!(
114114
p("\\\\.").join("C:"),
115115
p("C:"),
116-
"device-namespace-unc + win-drive-relative = win-drive-relative - c: was supposed to be relative, but it's not acting like it."
116+
"device-namespace-unc + win-drive-relative = win-drive-relative - C: as a relative path is not the C: device, so this is not \\\\.\\C:"
117117
);
118118
assert_eq!(p("relative").join("C:"), p("C:"), "relative + win-drive = win-drive");
119119

0 commit comments

Comments
 (0)