Fossil SCM

Avoid a slow case on a query in /fdiff when both v1 and v2 evaluate to zero.

drh 2025-04-10 22:42 trunk
Commit e3c58afb9da7b0efa24deef7a255a8149e771079d14694dbb435b912cc20f8df
1 file changed +2 -1
+2 -1
--- src/info.c
+++ src/info.c
@@ -1970,14 +1970,16 @@
19701970
diff_config_init(&DCfg, 0);
19711971
diffType = preferred_diff_type();
19721972
if( P("from") && P("to") ){
19731973
v1 = artifact_from_ci_and_filename("from");
19741974
v2 = artifact_from_ci_and_filename("to");
1975
+ if( v1==0 || v2==0 ) fossil_redirect_home();
19751976
}else{
19761977
Stmt q;
19771978
v1 = name_to_rid_www("v1");
19781979
v2 = name_to_rid_www("v2");
1980
+ if( v1==0 || v2==0 ) fossil_redirect_home();
19791981
19801982
/* If the two file versions being compared both have the same
19811983
** filename, then offer an "Annotate" link that constructs an
19821984
** annotation between those version. */
19831985
db_prepare(&q,
@@ -2003,11 +2005,10 @@
20032005
"%R/annotate?origin=%s&checkin=%s&filename=%T",
20042006
zOrig, zCkin, zFN);
20052007
}
20062008
db_finalize(&q);
20072009
}
2008
- if( v1==0 || v2==0 ) fossil_redirect_home();
20092010
zRe = P("regex");
20102011
cgi_check_for_malice();
20112012
if( zRe ) re_compile(&pRe, zRe, 0);
20122013
if( verbose ) objdescFlags |= OBJDESC_DETAIL;
20132014
if( isPatch ){
20142015
--- src/info.c
+++ src/info.c
@@ -1970,14 +1970,16 @@
1970 diff_config_init(&DCfg, 0);
1971 diffType = preferred_diff_type();
1972 if( P("from") && P("to") ){
1973 v1 = artifact_from_ci_and_filename("from");
1974 v2 = artifact_from_ci_and_filename("to");
 
1975 }else{
1976 Stmt q;
1977 v1 = name_to_rid_www("v1");
1978 v2 = name_to_rid_www("v2");
 
1979
1980 /* If the two file versions being compared both have the same
1981 ** filename, then offer an "Annotate" link that constructs an
1982 ** annotation between those version. */
1983 db_prepare(&q,
@@ -2003,11 +2005,10 @@
2003 "%R/annotate?origin=%s&checkin=%s&filename=%T",
2004 zOrig, zCkin, zFN);
2005 }
2006 db_finalize(&q);
2007 }
2008 if( v1==0 || v2==0 ) fossil_redirect_home();
2009 zRe = P("regex");
2010 cgi_check_for_malice();
2011 if( zRe ) re_compile(&pRe, zRe, 0);
2012 if( verbose ) objdescFlags |= OBJDESC_DETAIL;
2013 if( isPatch ){
2014
--- src/info.c
+++ src/info.c
@@ -1970,14 +1970,16 @@
1970 diff_config_init(&DCfg, 0);
1971 diffType = preferred_diff_type();
1972 if( P("from") && P("to") ){
1973 v1 = artifact_from_ci_and_filename("from");
1974 v2 = artifact_from_ci_and_filename("to");
1975 if( v1==0 || v2==0 ) fossil_redirect_home();
1976 }else{
1977 Stmt q;
1978 v1 = name_to_rid_www("v1");
1979 v2 = name_to_rid_www("v2");
1980 if( v1==0 || v2==0 ) fossil_redirect_home();
1981
1982 /* If the two file versions being compared both have the same
1983 ** filename, then offer an "Annotate" link that constructs an
1984 ** annotation between those version. */
1985 db_prepare(&q,
@@ -2003,11 +2005,10 @@
2005 "%R/annotate?origin=%s&checkin=%s&filename=%T",
2006 zOrig, zCkin, zFN);
2007 }
2008 db_finalize(&q);
2009 }
 
2010 zRe = P("regex");
2011 cgi_check_for_malice();
2012 if( zRe ) re_compile(&pRe, zRe, 0);
2013 if( verbose ) objdescFlags |= OBJDESC_DETAIL;
2014 if( isPatch ){
2015

Keyboard Shortcuts

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