Fossil SCM

In file_relative_name(), append the remainder of the path by its own length, and do not add a second trailing slash under --slash. The length was taken from the working directory's name, so the path's terminator and the bytes after it were read and copied.

dmestas 2026-11-13 23:39 UTC small-fixes-2
Commit aca46352a89147d16f98ee797b7a23e39378debb0f24d44239bf4d8296475f24
1 file changed +3 -2
+3 -2
--- src/file.c
+++ src/file.c
@@ -1827,13 +1827,14 @@
18271827
if( zPwd[j]=='/' ){
18281828
blob_append(pOut, "/..", 3);
18291829
}
18301830
}
18311831
while( i>0 && (zPwd[i]!='/')) --i;
1832
- blob_append(pOut, zPath+i, j-i);
1832
+ blob_append(pOut, zPath+i, -1);
18331833
}
1834
- if( slash && i>0 && zPath[strlen(zPath)-1]=='/'){
1834
+ if( slash && i>0 && zPath[strlen(zPath)-1]=='/'
1835
+ && blob_buffer(pOut)[blob_size(pOut)-1]!='/' ){
18351836
blob_append(pOut, "/", 1);
18361837
}
18371838
blob_reset(&tmp);
18381839
return;
18391840
}
18401841
--- src/file.c
+++ src/file.c
@@ -1827,13 +1827,14 @@
1827 if( zPwd[j]=='/' ){
1828 blob_append(pOut, "/..", 3);
1829 }
1830 }
1831 while( i>0 && (zPwd[i]!='/')) --i;
1832 blob_append(pOut, zPath+i, j-i);
1833 }
1834 if( slash && i>0 && zPath[strlen(zPath)-1]=='/'){
 
1835 blob_append(pOut, "/", 1);
1836 }
1837 blob_reset(&tmp);
1838 return;
1839 }
1840
--- src/file.c
+++ src/file.c
@@ -1827,13 +1827,14 @@
1827 if( zPwd[j]=='/' ){
1828 blob_append(pOut, "/..", 3);
1829 }
1830 }
1831 while( i>0 && (zPwd[i]!='/')) --i;
1832 blob_append(pOut, zPath+i, -1);
1833 }
1834 if( slash && i>0 && zPath[strlen(zPath)-1]=='/'
1835 && blob_buffer(pOut)[blob_size(pOut)-1]!='/' ){
1836 blob_append(pOut, "/", 1);
1837 }
1838 blob_reset(&tmp);
1839 return;
1840 }
1841

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button