Fossil SCM
Avoid a slow case on a query in /fdiff when both v1 and v2 evaluate to zero.
Commit
e3c58afb9da7b0efa24deef7a255a8149e771079d14694dbb435b912cc20f8df
Parent
95c924411910f1d…
1 file changed
+2
-1
+2
-1
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -1970,14 +1970,16 @@ | ||
| 1970 | 1970 | diff_config_init(&DCfg, 0); |
| 1971 | 1971 | diffType = preferred_diff_type(); |
| 1972 | 1972 | if( P("from") && P("to") ){ |
| 1973 | 1973 | v1 = artifact_from_ci_and_filename("from"); |
| 1974 | 1974 | v2 = artifact_from_ci_and_filename("to"); |
| 1975 | + if( v1==0 || v2==0 ) fossil_redirect_home(); | |
| 1975 | 1976 | }else{ |
| 1976 | 1977 | Stmt q; |
| 1977 | 1978 | v1 = name_to_rid_www("v1"); |
| 1978 | 1979 | v2 = name_to_rid_www("v2"); |
| 1980 | + if( v1==0 || v2==0 ) fossil_redirect_home(); | |
| 1979 | 1981 | |
| 1980 | 1982 | /* If the two file versions being compared both have the same |
| 1981 | 1983 | ** filename, then offer an "Annotate" link that constructs an |
| 1982 | 1984 | ** annotation between those version. */ |
| 1983 | 1985 | db_prepare(&q, |
| @@ -2003,11 +2005,10 @@ | ||
| 2003 | 2005 | "%R/annotate?origin=%s&checkin=%s&filename=%T", |
| 2004 | 2006 | zOrig, zCkin, zFN); |
| 2005 | 2007 | } |
| 2006 | 2008 | db_finalize(&q); |
| 2007 | 2009 | } |
| 2008 | - if( v1==0 || v2==0 ) fossil_redirect_home(); | |
| 2009 | 2010 | zRe = P("regex"); |
| 2010 | 2011 | cgi_check_for_malice(); |
| 2011 | 2012 | if( zRe ) re_compile(&pRe, zRe, 0); |
| 2012 | 2013 | if( verbose ) objdescFlags |= OBJDESC_DETAIL; |
| 2013 | 2014 | if( isPatch ){ |
| 2014 | 2015 |
| --- 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 |