Fossil SCM

If the "info" webpage references an ambiguous artifact ID, show all of the possible results.

drh 2011-03-23 12:32 trunk
Commit 2c8ea5ff2cc7b1175796353243f6115f706af43b
1 file changed +11 -2
+11 -2
--- src/info.c
+++ src/info.c
@@ -1362,10 +1362,11 @@
13621362
*/
13631363
void info_page(void){
13641364
const char *zName;
13651365
Blob uuid;
13661366
int rid;
1367
+ int rc;
13671368
13681369
zName = P("name");
13691370
if( zName==0 ) fossil_redirect_home();
13701371
if( validate16(zName, strlen(zName)) ){
13711372
if( db_exists("SELECT 1 FROM ticket WHERE tkt_uuid GLOB '%q*'", zName) ){
@@ -1376,12 +1377,20 @@
13761377
event_page();
13771378
return;
13781379
}
13791380
}
13801381
blob_set(&uuid, zName);
1381
- if( name_to_uuid(&uuid, 1) ){
1382
- fossil_redirect_home();
1382
+ rc = name_to_uuid(&uuid, -1);
1383
+ if( rc==1 ){
1384
+ style_header("No Such Object");
1385
+ @ <p>No such object: %h(zName)</p>
1386
+ style_footer();
1387
+ return;
1388
+ }else if( rc==2 ){
1389
+ cgi_set_parameter("src","info");
1390
+ ambiguous_page();
1391
+ return;
13831392
}
13841393
zName = blob_str(&uuid);
13851394
rid = db_int(0, "SELECT rid FROM blob WHERE uuid='%s'", zName);
13861395
if( rid==0 ){
13871396
style_header("Broken Link");
13881397
--- src/info.c
+++ src/info.c
@@ -1362,10 +1362,11 @@
1362 */
1363 void info_page(void){
1364 const char *zName;
1365 Blob uuid;
1366 int rid;
 
1367
1368 zName = P("name");
1369 if( zName==0 ) fossil_redirect_home();
1370 if( validate16(zName, strlen(zName)) ){
1371 if( db_exists("SELECT 1 FROM ticket WHERE tkt_uuid GLOB '%q*'", zName) ){
@@ -1376,12 +1377,20 @@
1376 event_page();
1377 return;
1378 }
1379 }
1380 blob_set(&uuid, zName);
1381 if( name_to_uuid(&uuid, 1) ){
1382 fossil_redirect_home();
 
 
 
 
 
 
 
 
1383 }
1384 zName = blob_str(&uuid);
1385 rid = db_int(0, "SELECT rid FROM blob WHERE uuid='%s'", zName);
1386 if( rid==0 ){
1387 style_header("Broken Link");
1388
--- src/info.c
+++ src/info.c
@@ -1362,10 +1362,11 @@
1362 */
1363 void info_page(void){
1364 const char *zName;
1365 Blob uuid;
1366 int rid;
1367 int rc;
1368
1369 zName = P("name");
1370 if( zName==0 ) fossil_redirect_home();
1371 if( validate16(zName, strlen(zName)) ){
1372 if( db_exists("SELECT 1 FROM ticket WHERE tkt_uuid GLOB '%q*'", zName) ){
@@ -1376,12 +1377,20 @@
1377 event_page();
1378 return;
1379 }
1380 }
1381 blob_set(&uuid, zName);
1382 rc = name_to_uuid(&uuid, -1);
1383 if( rc==1 ){
1384 style_header("No Such Object");
1385 @ <p>No such object: %h(zName)</p>
1386 style_footer();
1387 return;
1388 }else if( rc==2 ){
1389 cgi_set_parameter("src","info");
1390 ambiguous_page();
1391 return;
1392 }
1393 zName = blob_str(&uuid);
1394 rid = db_int(0, "SELECT rid FROM blob WHERE uuid='%s'", zName);
1395 if( rid==0 ){
1396 style_header("Broken Link");
1397

Keyboard Shortcuts

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