Fossil SCM

Show an error page when a managed file is not known at the requested check-in.

ashepilko 2020-05-10 03:12 trunk
Commit 78d52675c519a020066306ea0d4aa03916e92188040e3106a980b199d62607fc
1 file changed +24 -3
+24 -3
--- src/info.c
+++ src/info.c
@@ -2140,11 +2140,11 @@
21402140
blob_zero(&dirname);
21412141
hyperlinked_path(zName, &dirname, zCI, "dir", "");
21422142
blob_reset(&dirname);
21432143
21442144
if( name_to_uuid2(zCI, "ci", &zCIUuid) ){
2145
- isSymbolicCI = (strncmp(zCIUuid, zCI, strlen(zCI)) != 0);
2145
+ isSymbolicCI = (sqlite3_strnicmp(zCIUuid, zCI, strlen(zCI)) != 0);
21462146
}
21472147
}
21482148
if( isFile && zName ) {
21492149
rid = artifact_from_ci_and_filename(0, "name");
21502150
}else{
@@ -2151,10 +2151,12 @@
21512151
rid = artifact_from_ci_and_filename(&url, 0);
21522152
}
21532153
if( rid==0 ){
21542154
url_add_parameter(&url, "name", zName);
21552155
if( isFile ){
2156
+ int isUnknownAtCI = 0;
2157
+
21562158
/* Do a top-level directory listing in /file mode if no argument
21572159
** specified */
21582160
if( zName==0 || zName[0]==0 ){
21592161
if( P("ci")==0 ) cgi_set_query_parameter("ci","tip");
21602162
page_tree();
@@ -2167,10 +2169,17 @@
21672169
" AND mlink.fnid=filename.fnid"
21682170
" AND event.objid=mlink.mid"
21692171
" ORDER BY event.mtime DESC LIMIT 1",
21702172
zName
21712173
);
2174
+ /* If found only by the name, then the file is unknown in the check-in.
2175
+ ** Possibly, the file was renamed/deleted.
2176
+ */
2177
+ if( rid && zCIUuid ){
2178
+ rid = 0;
2179
+ isUnknownAtCI = 1;
2180
+ }
21722181
/* If no file called NAME exists, instead look for a directory
21732182
** with that name, and do a directory listing */
21742183
if( rid==0 ){
21752184
int nName = (int)strlen(zName);
21762185
if( nName && zName[nName-1]=='/' ) nName--;
@@ -2184,12 +2193,24 @@
21842193
return;
21852194
}
21862195
}
21872196
/* If no file or directory called NAME: issue an error */
21882197
if( rid==0 ){
2189
- style_header("No such file");
2190
- @ File '%h(zName)' does not exist in this repository.
2198
+ if( isUnknownAtCI ){
2199
+ if( isSymbolicCI ){
2200
+ zHeader = mprintf("No such file at %s", zCI);
2201
+ }else{
2202
+ zHeader = mprintf("No such file at [%S]", zCIUuid);
2203
+ }
2204
+ style_header("%s", zHeader);
2205
+ fossil_free(zHeader);
2206
+ @ File %z(href("%R/finfo?name=%T",zName))%h(zName)</a> does not exist
2207
+ @ in check-in [%z(href("/info/%!S",zCIUuid))%S(zCIUuid)</a>].
2208
+ }else{
2209
+ style_header("No such file");
2210
+ @ File '%h(zName)' does not exist in this repository.
2211
+ }
21912212
style_footer();
21922213
return;
21932214
}
21942215
}else{
21952216
rid = name_to_rid_www("name");
21962217
--- src/info.c
+++ src/info.c
@@ -2140,11 +2140,11 @@
2140 blob_zero(&dirname);
2141 hyperlinked_path(zName, &dirname, zCI, "dir", "");
2142 blob_reset(&dirname);
2143
2144 if( name_to_uuid2(zCI, "ci", &zCIUuid) ){
2145 isSymbolicCI = (strncmp(zCIUuid, zCI, strlen(zCI)) != 0);
2146 }
2147 }
2148 if( isFile && zName ) {
2149 rid = artifact_from_ci_and_filename(0, "name");
2150 }else{
@@ -2151,10 +2151,12 @@
2151 rid = artifact_from_ci_and_filename(&url, 0);
2152 }
2153 if( rid==0 ){
2154 url_add_parameter(&url, "name", zName);
2155 if( isFile ){
 
 
2156 /* Do a top-level directory listing in /file mode if no argument
2157 ** specified */
2158 if( zName==0 || zName[0]==0 ){
2159 if( P("ci")==0 ) cgi_set_query_parameter("ci","tip");
2160 page_tree();
@@ -2167,10 +2169,17 @@
2167 " AND mlink.fnid=filename.fnid"
2168 " AND event.objid=mlink.mid"
2169 " ORDER BY event.mtime DESC LIMIT 1",
2170 zName
2171 );
 
 
 
 
 
 
 
2172 /* If no file called NAME exists, instead look for a directory
2173 ** with that name, and do a directory listing */
2174 if( rid==0 ){
2175 int nName = (int)strlen(zName);
2176 if( nName && zName[nName-1]=='/' ) nName--;
@@ -2184,12 +2193,24 @@
2184 return;
2185 }
2186 }
2187 /* If no file or directory called NAME: issue an error */
2188 if( rid==0 ){
2189 style_header("No such file");
2190 @ File '%h(zName)' does not exist in this repository.
 
 
 
 
 
 
 
 
 
 
 
 
2191 style_footer();
2192 return;
2193 }
2194 }else{
2195 rid = name_to_rid_www("name");
2196
--- src/info.c
+++ src/info.c
@@ -2140,11 +2140,11 @@
2140 blob_zero(&dirname);
2141 hyperlinked_path(zName, &dirname, zCI, "dir", "");
2142 blob_reset(&dirname);
2143
2144 if( name_to_uuid2(zCI, "ci", &zCIUuid) ){
2145 isSymbolicCI = (sqlite3_strnicmp(zCIUuid, zCI, strlen(zCI)) != 0);
2146 }
2147 }
2148 if( isFile && zName ) {
2149 rid = artifact_from_ci_and_filename(0, "name");
2150 }else{
@@ -2151,10 +2151,12 @@
2151 rid = artifact_from_ci_and_filename(&url, 0);
2152 }
2153 if( rid==0 ){
2154 url_add_parameter(&url, "name", zName);
2155 if( isFile ){
2156 int isUnknownAtCI = 0;
2157
2158 /* Do a top-level directory listing in /file mode if no argument
2159 ** specified */
2160 if( zName==0 || zName[0]==0 ){
2161 if( P("ci")==0 ) cgi_set_query_parameter("ci","tip");
2162 page_tree();
@@ -2167,10 +2169,17 @@
2169 " AND mlink.fnid=filename.fnid"
2170 " AND event.objid=mlink.mid"
2171 " ORDER BY event.mtime DESC LIMIT 1",
2172 zName
2173 );
2174 /* If found only by the name, then the file is unknown in the check-in.
2175 ** Possibly, the file was renamed/deleted.
2176 */
2177 if( rid && zCIUuid ){
2178 rid = 0;
2179 isUnknownAtCI = 1;
2180 }
2181 /* If no file called NAME exists, instead look for a directory
2182 ** with that name, and do a directory listing */
2183 if( rid==0 ){
2184 int nName = (int)strlen(zName);
2185 if( nName && zName[nName-1]=='/' ) nName--;
@@ -2184,12 +2193,24 @@
2193 return;
2194 }
2195 }
2196 /* If no file or directory called NAME: issue an error */
2197 if( rid==0 ){
2198 if( isUnknownAtCI ){
2199 if( isSymbolicCI ){
2200 zHeader = mprintf("No such file at %s", zCI);
2201 }else{
2202 zHeader = mprintf("No such file at [%S]", zCIUuid);
2203 }
2204 style_header("%s", zHeader);
2205 fossil_free(zHeader);
2206 @ File %z(href("%R/finfo?name=%T",zName))%h(zName)</a> does not exist
2207 @ in check-in [%z(href("/info/%!S",zCIUuid))%S(zCIUuid)</a>].
2208 }else{
2209 style_header("No such file");
2210 @ File '%h(zName)' does not exist in this repository.
2211 }
2212 style_footer();
2213 return;
2214 }
2215 }else{
2216 rid = name_to_rid_www("name");
2217

Keyboard Shortcuts

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