Fossil SCM

New setting "large-file-size" is a 64-bit integer. If any file of a check-in is larger than this amount, a warning is issues that the users has to confirm before continuing. Warnings can be bypassed using --ignore-oversize or --no-warnings. Use "fossil set large-file-size 0" to permanently disable this warning. Default value is 20,000,000.

drh 2022-01-01 00:36 trunk
Commit 3ffe893f88a4b65b6a1ac6e9d5f2039a1d4d7f390d83a2697a380a03fe0eeeef
2 files changed +50 -26 +11
+50 -26
--- src/checkin.c
+++ src/checkin.c
@@ -1847,10 +1847,11 @@
18471847
static int commit_warning(
18481848
Blob *pContent, /* The content of the file being committed. */
18491849
int crlfOk, /* Non-zero if CR/LF warnings should be disabled. */
18501850
int binOk, /* Non-zero if binary warnings should be disabled. */
18511851
int encodingOk, /* Non-zero if encoding warnings should be disabled. */
1852
+ int sizeOk, /* Non-zero if oversize warnings are disabled */
18521853
int noPrompt, /* 0 to always prompt, 1 for 'N', 2 for 'Y'. */
18531854
const char *zFilename, /* The full name of the file being committed. */
18541855
Blob *pReason /* Reason for warning, if any (non-fatal only). */
18551856
){
18561857
int bReverse; /* UTF-16 byte order is reversed? */
@@ -1864,27 +1865,32 @@
18641865
char *zMsg; /* Warning message */
18651866
Blob fname; /* Relative pathname of the file */
18661867
static int allOk = 0; /* Set to true to disable this routine */
18671868
18681869
if( allOk ) return 0;
1869
- fUnicode = could_be_utf16(pContent, &bReverse);
1870
- if( fUnicode ){
1871
- lookFlags = looks_like_utf16(pContent, bReverse, LOOK_NUL);
1870
+ if( sizeOk ){
1871
+ fUnicode = could_be_utf16(pContent, &bReverse);
1872
+ if( fUnicode ){
1873
+ lookFlags = looks_like_utf16(pContent, bReverse, LOOK_NUL);
1874
+ }else{
1875
+ lookFlags = looks_like_utf8(pContent, LOOK_NUL);
1876
+ if( !(lookFlags & LOOK_BINARY) && invalid_utf8(pContent) ){
1877
+ fHasInvalidUtf8 = 1;
1878
+ }
1879
+ }
1880
+ fHasAnyCr = (lookFlags & LOOK_CR);
1881
+ fBinary = (lookFlags & LOOK_BINARY);
1882
+ fHasLoneCrOnly = ((lookFlags & LOOK_EOL) == LOOK_LONE_CR);
1883
+ fHasCrLfOnly = ((lookFlags & LOOK_EOL) == LOOK_CRLF);
18721884
}else{
1873
- lookFlags = looks_like_utf8(pContent, LOOK_NUL);
1874
- if( !(lookFlags & LOOK_BINARY) && invalid_utf8(pContent) ){
1875
- fHasInvalidUtf8 = 1;
1876
- }
1877
- }
1878
- fHasAnyCr = (lookFlags & LOOK_CR);
1879
- fBinary = (lookFlags & LOOK_BINARY);
1880
- fHasLoneCrOnly = ((lookFlags & LOOK_EOL) == LOOK_LONE_CR);
1881
- fHasCrLfOnly = ((lookFlags & LOOK_EOL) == LOOK_CRLF);
1882
- if( fUnicode || fHasAnyCr || fBinary || fHasInvalidUtf8 ){
1883
- const char *zWarning;
1884
- const char *zDisable;
1885
+ fUnicode = fHasAnyCr = fBinary = fHasInvalidUtf8 = 0;
1886
+ }
1887
+ if( !sizeOk || fUnicode || fHasAnyCr || fBinary || fHasInvalidUtf8 ){
1888
+ const char *zWarning = 0;
1889
+ const char *zDisable = 0;
18851890
const char *zConvert = "c=convert/";
1891
+ const char *zIn = "in";
18861892
Blob ans;
18871893
char cReply;
18881894
18891895
if( fBinary ){
18901896
int fHasNul = (lookFlags & LOOK_NUL); /* contains NUL chars? */
@@ -1928,23 +1934,33 @@
19281934
zWarning = "CR/LF line endings";
19291935
}else{
19301936
zWarning = "mixed line endings";
19311937
}
19321938
zDisable = "\"crlf-glob\" setting";
1939
+ }else if( !sizeOk ){
1940
+ zWarning = "oversize";
1941
+ zIn = "file";
19331942
}else{
19341943
if( encodingOk ){
19351944
return 0; /* We don't want encoding warnings for this file. */
19361945
}
19371946
zWarning = "Unicode";
19381947
zDisable = "\"encoding-glob\" setting";
19391948
}
19401949
file_relative_name(zFilename, &fname, 0);
1941
- zMsg = mprintf(
1942
- "%s contains %s. Use --no-warnings or the %s to"
1943
- " disable this warning.\n"
1944
- "Commit anyhow (a=all/%sy/N)? ",
1945
- blob_str(&fname), zWarning, zDisable, zConvert);
1950
+ if( !sizeOk ){
1951
+ zMsg = mprintf(
1952
+ "%s is more than %,lld bytes in size.\n"
1953
+ "Commit anyhow (a=all/y/N)? ",
1954
+ blob_str(&fname), db_large_file_size());
1955
+ }else{
1956
+ zMsg = mprintf(
1957
+ "%s contains %s. Use --no-warnings or the %s to"
1958
+ " disable this warning.\n"
1959
+ "Commit anyhow (a=all/%sy/N)? ",
1960
+ blob_str(&fname), zWarning, zDisable, zConvert);
1961
+ }
19461962
if( noPrompt==0 ){
19471963
prompt_user(zMsg, &ans);
19481964
cReply = blob_str(&ans)[0];
19491965
blob_reset(&ans);
19501966
}else if( noPrompt==2 ){
@@ -1978,12 +1994,12 @@
19781994
fwrite(blob_buffer(pContent), 1, blob_size(pContent), f);
19791995
fclose(f);
19801996
}
19811997
return 1;
19821998
}else if( cReply!='y' && cReply!='Y' ){
1983
- fossil_fatal("Abandoning commit due to %s in %s",
1984
- zWarning, blob_str(&fname));
1999
+ fossil_fatal("Abandoning commit due to %s %s %s",
2000
+ zWarning, zIn, blob_str(&fname));
19852001
}else if( noPrompt==2 ){
19862002
if( pReason ){
19872003
blob_append(pReason, zWarning, -1);
19882004
}
19892005
return 1;
@@ -2009,15 +2025,17 @@
20092025
*/
20102026
void test_commit_warning(void){
20112027
int rc = 0;
20122028
int noSettings;
20132029
int verboseFlag;
2030
+ i64 mxSize;
20142031
Stmt q;
20152032
noSettings = find_option("no-settings",0,0)!=0;
20162033
verboseFlag = find_option("verbose","v",0)!=0;
20172034
verify_all_options();
20182035
db_must_be_within_tree();
2036
+ mxSize = db_large_file_size();
20192037
db_prepare(&q,
20202038
"SELECT %Q || pathname, pathname, %s, %s, %s FROM vfile"
20212039
" WHERE NOT deleted",
20222040
g.zLocalRoot,
20232041
glob_expr("pathname", noSettings ? 0 : db_get("crlf-glob",
@@ -2028,22 +2046,23 @@
20282046
while( db_step(&q)==SQLITE_ROW ){
20292047
const char *zFullname;
20302048
const char *zName;
20312049
Blob content;
20322050
Blob reason;
2033
- int crlfOk, binOk, encodingOk;
2051
+ int crlfOk, binOk, encodingOk, sizeOk;
20342052
int fileRc;
20352053
20362054
zFullname = db_column_text(&q, 0);
20372055
zName = db_column_text(&q, 1);
20382056
crlfOk = db_column_int(&q, 2);
20392057
binOk = db_column_int(&q, 3);
20402058
encodingOk = db_column_int(&q, 4);
2059
+ sizeOk = mxSize<=0 || file_size(zFullname, ExtFILE)<=mxSize;
20412060
blob_zero(&content);
20422061
blob_read_from_file(&content, zFullname, RepoFILE);
20432062
blob_zero(&reason);
2044
- fileRc = commit_warning(&content, crlfOk, binOk, encodingOk, 2,
2063
+ fileRc = commit_warning(&content, crlfOk, binOk, encodingOk, sizeOk, 2,
20452064
zFullname, &reason);
20462065
if( fileRc || verboseFlag ){
20472066
fossil_print("%d\t%s\t%s\n", fileRc, zName, blob_str(&reason));
20482067
}
20492068
blob_reset(&reason);
@@ -2138,10 +2157,11 @@
21382157
** than relying on file mtimes
21392158
** --ignore-clock-skew If a clock skew is detected, ignore it and
21402159
** behave as if the user had entered 'yes' to
21412160
** the question of whether to proceed despite
21422161
** the skew.
2162
+** --ignore-oversize Do not warning the user about oversized files
21432163
** --integrate close all merged-in branches
21442164
** -m|--comment COMMENT-TEXT use COMMENT-TEXT as commit comment
21452165
** -M|--message-file FILE read the commit comment from given file
21462166
** --mimetype MIMETYPE mimetype of check-in comment
21472167
** -n|--dry-run If given, display instead of run actions
@@ -2212,10 +2232,11 @@
22122232
Blob ans; /* Answer to continuation prompts */
22132233
char cReply; /* First character of ans */
22142234
int bRecheck = 0; /* Repeat fork and closed-branch checks*/
22152235
int bAutoBrClr = 0; /* Value of "--branchcolor" is "auto" */
22162236
int bIgnoreSkew = 0; /* --ignore-clock-skew flag */
2237
+ int mxSize;
22172238
22182239
memset(&sCiInfo, 0, sizeof(sCiInfo));
22192240
url_proxy_options();
22202241
/* --sha1sum is an undocumented alias for --hash for backwards compatiblity */
22212242
useHash = find_option("hash",0,0)!=0 || find_option("sha1sum",0,0)!=0;
@@ -2271,10 +2292,12 @@
22712292
noSign = db_get_boolean("omitsign", 0)|noSign;
22722293
if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; }
22732294
useCksum = db_get_boolean("repo-cksum", 1);
22742295
bIgnoreSkew = find_option("ignore-clock-skew",0,0)!=0;
22752296
outputManifest = db_get_manifest_setting();
2297
+ mxSize = db_large_file_size();
2298
+ if( find_option("ignore-oversize",0,0)!=0 ) mxSize = 0;
22762299
verify_all_options();
22772300
22782301
/* Get the ID of the parent manifest artifact */
22792302
vid = db_lget_int("checkout", 0);
22802303
if( vid==0 ){
@@ -2592,25 +2615,26 @@
25922615
);
25932616
while( db_step(&q)==SQLITE_ROW ){
25942617
int id, rid;
25952618
const char *zFullname;
25962619
Blob content;
2597
- int crlfOk, binOk, encodingOk;
2620
+ int crlfOk, binOk, encodingOk, sizeOk;
25982621
25992622
id = db_column_int(&q, 0);
26002623
zFullname = db_column_text(&q, 1);
26012624
rid = db_column_int(&q, 2);
26022625
crlfOk = db_column_int(&q, 3);
26032626
binOk = db_column_int(&q, 4);
26042627
encodingOk = db_column_int(&q, 5);
2628
+ sizeOk = mxSize<=0 || file_size(zFullname, ExtFILE)<=mxSize;
26052629
26062630
blob_zero(&content);
26072631
blob_read_from_file(&content, zFullname, RepoFILE);
26082632
/* Do not emit any warnings when they are disabled. */
26092633
if( !noWarningFlag ){
26102634
abortCommit |= commit_warning(&content, crlfOk, binOk,
2611
- encodingOk, noPrompt,
2635
+ encodingOk, sizeOk, noPrompt,
26122636
zFullname, 0);
26132637
}
26142638
if( contains_merge_marker(&content) ){
26152639
Blob fname; /* Relative pathname of the file */
26162640
26172641
--- src/checkin.c
+++ src/checkin.c
@@ -1847,10 +1847,11 @@
1847 static int commit_warning(
1848 Blob *pContent, /* The content of the file being committed. */
1849 int crlfOk, /* Non-zero if CR/LF warnings should be disabled. */
1850 int binOk, /* Non-zero if binary warnings should be disabled. */
1851 int encodingOk, /* Non-zero if encoding warnings should be disabled. */
 
1852 int noPrompt, /* 0 to always prompt, 1 for 'N', 2 for 'Y'. */
1853 const char *zFilename, /* The full name of the file being committed. */
1854 Blob *pReason /* Reason for warning, if any (non-fatal only). */
1855 ){
1856 int bReverse; /* UTF-16 byte order is reversed? */
@@ -1864,27 +1865,32 @@
1864 char *zMsg; /* Warning message */
1865 Blob fname; /* Relative pathname of the file */
1866 static int allOk = 0; /* Set to true to disable this routine */
1867
1868 if( allOk ) return 0;
1869 fUnicode = could_be_utf16(pContent, &bReverse);
1870 if( fUnicode ){
1871 lookFlags = looks_like_utf16(pContent, bReverse, LOOK_NUL);
 
 
 
 
 
 
 
 
 
 
 
1872 }else{
1873 lookFlags = looks_like_utf8(pContent, LOOK_NUL);
1874 if( !(lookFlags & LOOK_BINARY) && invalid_utf8(pContent) ){
1875 fHasInvalidUtf8 = 1;
1876 }
1877 }
1878 fHasAnyCr = (lookFlags & LOOK_CR);
1879 fBinary = (lookFlags & LOOK_BINARY);
1880 fHasLoneCrOnly = ((lookFlags & LOOK_EOL) == LOOK_LONE_CR);
1881 fHasCrLfOnly = ((lookFlags & LOOK_EOL) == LOOK_CRLF);
1882 if( fUnicode || fHasAnyCr || fBinary || fHasInvalidUtf8 ){
1883 const char *zWarning;
1884 const char *zDisable;
1885 const char *zConvert = "c=convert/";
 
1886 Blob ans;
1887 char cReply;
1888
1889 if( fBinary ){
1890 int fHasNul = (lookFlags & LOOK_NUL); /* contains NUL chars? */
@@ -1928,23 +1934,33 @@
1928 zWarning = "CR/LF line endings";
1929 }else{
1930 zWarning = "mixed line endings";
1931 }
1932 zDisable = "\"crlf-glob\" setting";
 
 
 
1933 }else{
1934 if( encodingOk ){
1935 return 0; /* We don't want encoding warnings for this file. */
1936 }
1937 zWarning = "Unicode";
1938 zDisable = "\"encoding-glob\" setting";
1939 }
1940 file_relative_name(zFilename, &fname, 0);
1941 zMsg = mprintf(
1942 "%s contains %s. Use --no-warnings or the %s to"
1943 " disable this warning.\n"
1944 "Commit anyhow (a=all/%sy/N)? ",
1945 blob_str(&fname), zWarning, zDisable, zConvert);
 
 
 
 
 
 
 
1946 if( noPrompt==0 ){
1947 prompt_user(zMsg, &ans);
1948 cReply = blob_str(&ans)[0];
1949 blob_reset(&ans);
1950 }else if( noPrompt==2 ){
@@ -1978,12 +1994,12 @@
1978 fwrite(blob_buffer(pContent), 1, blob_size(pContent), f);
1979 fclose(f);
1980 }
1981 return 1;
1982 }else if( cReply!='y' && cReply!='Y' ){
1983 fossil_fatal("Abandoning commit due to %s in %s",
1984 zWarning, blob_str(&fname));
1985 }else if( noPrompt==2 ){
1986 if( pReason ){
1987 blob_append(pReason, zWarning, -1);
1988 }
1989 return 1;
@@ -2009,15 +2025,17 @@
2009 */
2010 void test_commit_warning(void){
2011 int rc = 0;
2012 int noSettings;
2013 int verboseFlag;
 
2014 Stmt q;
2015 noSettings = find_option("no-settings",0,0)!=0;
2016 verboseFlag = find_option("verbose","v",0)!=0;
2017 verify_all_options();
2018 db_must_be_within_tree();
 
2019 db_prepare(&q,
2020 "SELECT %Q || pathname, pathname, %s, %s, %s FROM vfile"
2021 " WHERE NOT deleted",
2022 g.zLocalRoot,
2023 glob_expr("pathname", noSettings ? 0 : db_get("crlf-glob",
@@ -2028,22 +2046,23 @@
2028 while( db_step(&q)==SQLITE_ROW ){
2029 const char *zFullname;
2030 const char *zName;
2031 Blob content;
2032 Blob reason;
2033 int crlfOk, binOk, encodingOk;
2034 int fileRc;
2035
2036 zFullname = db_column_text(&q, 0);
2037 zName = db_column_text(&q, 1);
2038 crlfOk = db_column_int(&q, 2);
2039 binOk = db_column_int(&q, 3);
2040 encodingOk = db_column_int(&q, 4);
 
2041 blob_zero(&content);
2042 blob_read_from_file(&content, zFullname, RepoFILE);
2043 blob_zero(&reason);
2044 fileRc = commit_warning(&content, crlfOk, binOk, encodingOk, 2,
2045 zFullname, &reason);
2046 if( fileRc || verboseFlag ){
2047 fossil_print("%d\t%s\t%s\n", fileRc, zName, blob_str(&reason));
2048 }
2049 blob_reset(&reason);
@@ -2138,10 +2157,11 @@
2138 ** than relying on file mtimes
2139 ** --ignore-clock-skew If a clock skew is detected, ignore it and
2140 ** behave as if the user had entered 'yes' to
2141 ** the question of whether to proceed despite
2142 ** the skew.
 
2143 ** --integrate close all merged-in branches
2144 ** -m|--comment COMMENT-TEXT use COMMENT-TEXT as commit comment
2145 ** -M|--message-file FILE read the commit comment from given file
2146 ** --mimetype MIMETYPE mimetype of check-in comment
2147 ** -n|--dry-run If given, display instead of run actions
@@ -2212,10 +2232,11 @@
2212 Blob ans; /* Answer to continuation prompts */
2213 char cReply; /* First character of ans */
2214 int bRecheck = 0; /* Repeat fork and closed-branch checks*/
2215 int bAutoBrClr = 0; /* Value of "--branchcolor" is "auto" */
2216 int bIgnoreSkew = 0; /* --ignore-clock-skew flag */
 
2217
2218 memset(&sCiInfo, 0, sizeof(sCiInfo));
2219 url_proxy_options();
2220 /* --sha1sum is an undocumented alias for --hash for backwards compatiblity */
2221 useHash = find_option("hash",0,0)!=0 || find_option("sha1sum",0,0)!=0;
@@ -2271,10 +2292,12 @@
2271 noSign = db_get_boolean("omitsign", 0)|noSign;
2272 if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; }
2273 useCksum = db_get_boolean("repo-cksum", 1);
2274 bIgnoreSkew = find_option("ignore-clock-skew",0,0)!=0;
2275 outputManifest = db_get_manifest_setting();
 
 
2276 verify_all_options();
2277
2278 /* Get the ID of the parent manifest artifact */
2279 vid = db_lget_int("checkout", 0);
2280 if( vid==0 ){
@@ -2592,25 +2615,26 @@
2592 );
2593 while( db_step(&q)==SQLITE_ROW ){
2594 int id, rid;
2595 const char *zFullname;
2596 Blob content;
2597 int crlfOk, binOk, encodingOk;
2598
2599 id = db_column_int(&q, 0);
2600 zFullname = db_column_text(&q, 1);
2601 rid = db_column_int(&q, 2);
2602 crlfOk = db_column_int(&q, 3);
2603 binOk = db_column_int(&q, 4);
2604 encodingOk = db_column_int(&q, 5);
 
2605
2606 blob_zero(&content);
2607 blob_read_from_file(&content, zFullname, RepoFILE);
2608 /* Do not emit any warnings when they are disabled. */
2609 if( !noWarningFlag ){
2610 abortCommit |= commit_warning(&content, crlfOk, binOk,
2611 encodingOk, noPrompt,
2612 zFullname, 0);
2613 }
2614 if( contains_merge_marker(&content) ){
2615 Blob fname; /* Relative pathname of the file */
2616
2617
--- src/checkin.c
+++ src/checkin.c
@@ -1847,10 +1847,11 @@
1847 static int commit_warning(
1848 Blob *pContent, /* The content of the file being committed. */
1849 int crlfOk, /* Non-zero if CR/LF warnings should be disabled. */
1850 int binOk, /* Non-zero if binary warnings should be disabled. */
1851 int encodingOk, /* Non-zero if encoding warnings should be disabled. */
1852 int sizeOk, /* Non-zero if oversize warnings are disabled */
1853 int noPrompt, /* 0 to always prompt, 1 for 'N', 2 for 'Y'. */
1854 const char *zFilename, /* The full name of the file being committed. */
1855 Blob *pReason /* Reason for warning, if any (non-fatal only). */
1856 ){
1857 int bReverse; /* UTF-16 byte order is reversed? */
@@ -1864,27 +1865,32 @@
1865 char *zMsg; /* Warning message */
1866 Blob fname; /* Relative pathname of the file */
1867 static int allOk = 0; /* Set to true to disable this routine */
1868
1869 if( allOk ) return 0;
1870 if( sizeOk ){
1871 fUnicode = could_be_utf16(pContent, &bReverse);
1872 if( fUnicode ){
1873 lookFlags = looks_like_utf16(pContent, bReverse, LOOK_NUL);
1874 }else{
1875 lookFlags = looks_like_utf8(pContent, LOOK_NUL);
1876 if( !(lookFlags & LOOK_BINARY) && invalid_utf8(pContent) ){
1877 fHasInvalidUtf8 = 1;
1878 }
1879 }
1880 fHasAnyCr = (lookFlags & LOOK_CR);
1881 fBinary = (lookFlags & LOOK_BINARY);
1882 fHasLoneCrOnly = ((lookFlags & LOOK_EOL) == LOOK_LONE_CR);
1883 fHasCrLfOnly = ((lookFlags & LOOK_EOL) == LOOK_CRLF);
1884 }else{
1885 fUnicode = fHasAnyCr = fBinary = fHasInvalidUtf8 = 0;
1886 }
1887 if( !sizeOk || fUnicode || fHasAnyCr || fBinary || fHasInvalidUtf8 ){
1888 const char *zWarning = 0;
1889 const char *zDisable = 0;
 
 
 
 
 
 
 
1890 const char *zConvert = "c=convert/";
1891 const char *zIn = "in";
1892 Blob ans;
1893 char cReply;
1894
1895 if( fBinary ){
1896 int fHasNul = (lookFlags & LOOK_NUL); /* contains NUL chars? */
@@ -1928,23 +1934,33 @@
1934 zWarning = "CR/LF line endings";
1935 }else{
1936 zWarning = "mixed line endings";
1937 }
1938 zDisable = "\"crlf-glob\" setting";
1939 }else if( !sizeOk ){
1940 zWarning = "oversize";
1941 zIn = "file";
1942 }else{
1943 if( encodingOk ){
1944 return 0; /* We don't want encoding warnings for this file. */
1945 }
1946 zWarning = "Unicode";
1947 zDisable = "\"encoding-glob\" setting";
1948 }
1949 file_relative_name(zFilename, &fname, 0);
1950 if( !sizeOk ){
1951 zMsg = mprintf(
1952 "%s is more than %,lld bytes in size.\n"
1953 "Commit anyhow (a=all/y/N)? ",
1954 blob_str(&fname), db_large_file_size());
1955 }else{
1956 zMsg = mprintf(
1957 "%s contains %s. Use --no-warnings or the %s to"
1958 " disable this warning.\n"
1959 "Commit anyhow (a=all/%sy/N)? ",
1960 blob_str(&fname), zWarning, zDisable, zConvert);
1961 }
1962 if( noPrompt==0 ){
1963 prompt_user(zMsg, &ans);
1964 cReply = blob_str(&ans)[0];
1965 blob_reset(&ans);
1966 }else if( noPrompt==2 ){
@@ -1978,12 +1994,12 @@
1994 fwrite(blob_buffer(pContent), 1, blob_size(pContent), f);
1995 fclose(f);
1996 }
1997 return 1;
1998 }else if( cReply!='y' && cReply!='Y' ){
1999 fossil_fatal("Abandoning commit due to %s %s %s",
2000 zWarning, zIn, blob_str(&fname));
2001 }else if( noPrompt==2 ){
2002 if( pReason ){
2003 blob_append(pReason, zWarning, -1);
2004 }
2005 return 1;
@@ -2009,15 +2025,17 @@
2025 */
2026 void test_commit_warning(void){
2027 int rc = 0;
2028 int noSettings;
2029 int verboseFlag;
2030 i64 mxSize;
2031 Stmt q;
2032 noSettings = find_option("no-settings",0,0)!=0;
2033 verboseFlag = find_option("verbose","v",0)!=0;
2034 verify_all_options();
2035 db_must_be_within_tree();
2036 mxSize = db_large_file_size();
2037 db_prepare(&q,
2038 "SELECT %Q || pathname, pathname, %s, %s, %s FROM vfile"
2039 " WHERE NOT deleted",
2040 g.zLocalRoot,
2041 glob_expr("pathname", noSettings ? 0 : db_get("crlf-glob",
@@ -2028,22 +2046,23 @@
2046 while( db_step(&q)==SQLITE_ROW ){
2047 const char *zFullname;
2048 const char *zName;
2049 Blob content;
2050 Blob reason;
2051 int crlfOk, binOk, encodingOk, sizeOk;
2052 int fileRc;
2053
2054 zFullname = db_column_text(&q, 0);
2055 zName = db_column_text(&q, 1);
2056 crlfOk = db_column_int(&q, 2);
2057 binOk = db_column_int(&q, 3);
2058 encodingOk = db_column_int(&q, 4);
2059 sizeOk = mxSize<=0 || file_size(zFullname, ExtFILE)<=mxSize;
2060 blob_zero(&content);
2061 blob_read_from_file(&content, zFullname, RepoFILE);
2062 blob_zero(&reason);
2063 fileRc = commit_warning(&content, crlfOk, binOk, encodingOk, sizeOk, 2,
2064 zFullname, &reason);
2065 if( fileRc || verboseFlag ){
2066 fossil_print("%d\t%s\t%s\n", fileRc, zName, blob_str(&reason));
2067 }
2068 blob_reset(&reason);
@@ -2138,10 +2157,11 @@
2157 ** than relying on file mtimes
2158 ** --ignore-clock-skew If a clock skew is detected, ignore it and
2159 ** behave as if the user had entered 'yes' to
2160 ** the question of whether to proceed despite
2161 ** the skew.
2162 ** --ignore-oversize Do not warning the user about oversized files
2163 ** --integrate close all merged-in branches
2164 ** -m|--comment COMMENT-TEXT use COMMENT-TEXT as commit comment
2165 ** -M|--message-file FILE read the commit comment from given file
2166 ** --mimetype MIMETYPE mimetype of check-in comment
2167 ** -n|--dry-run If given, display instead of run actions
@@ -2212,10 +2232,11 @@
2232 Blob ans; /* Answer to continuation prompts */
2233 char cReply; /* First character of ans */
2234 int bRecheck = 0; /* Repeat fork and closed-branch checks*/
2235 int bAutoBrClr = 0; /* Value of "--branchcolor" is "auto" */
2236 int bIgnoreSkew = 0; /* --ignore-clock-skew flag */
2237 int mxSize;
2238
2239 memset(&sCiInfo, 0, sizeof(sCiInfo));
2240 url_proxy_options();
2241 /* --sha1sum is an undocumented alias for --hash for backwards compatiblity */
2242 useHash = find_option("hash",0,0)!=0 || find_option("sha1sum",0,0)!=0;
@@ -2271,10 +2292,12 @@
2292 noSign = db_get_boolean("omitsign", 0)|noSign;
2293 if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; }
2294 useCksum = db_get_boolean("repo-cksum", 1);
2295 bIgnoreSkew = find_option("ignore-clock-skew",0,0)!=0;
2296 outputManifest = db_get_manifest_setting();
2297 mxSize = db_large_file_size();
2298 if( find_option("ignore-oversize",0,0)!=0 ) mxSize = 0;
2299 verify_all_options();
2300
2301 /* Get the ID of the parent manifest artifact */
2302 vid = db_lget_int("checkout", 0);
2303 if( vid==0 ){
@@ -2592,25 +2615,26 @@
2615 );
2616 while( db_step(&q)==SQLITE_ROW ){
2617 int id, rid;
2618 const char *zFullname;
2619 Blob content;
2620 int crlfOk, binOk, encodingOk, sizeOk;
2621
2622 id = db_column_int(&q, 0);
2623 zFullname = db_column_text(&q, 1);
2624 rid = db_column_int(&q, 2);
2625 crlfOk = db_column_int(&q, 3);
2626 binOk = db_column_int(&q, 4);
2627 encodingOk = db_column_int(&q, 5);
2628 sizeOk = mxSize<=0 || file_size(zFullname, ExtFILE)<=mxSize;
2629
2630 blob_zero(&content);
2631 blob_read_from_file(&content, zFullname, RepoFILE);
2632 /* Do not emit any warnings when they are disabled. */
2633 if( !noWarningFlag ){
2634 abortCommit |= commit_warning(&content, crlfOk, binOk,
2635 encodingOk, sizeOk, noPrompt,
2636 zFullname, 0);
2637 }
2638 if( contains_merge_marker(&content) ){
2639 Blob fname; /* Relative pathname of the file */
2640
2641
+11
--- src/db.c
+++ src/db.c
@@ -3324,10 +3324,14 @@
33243324
}
33253325
db_reset(&q2);
33263326
}
33273327
return v;
33283328
}
3329
+i64 db_large_file_size(void){
3330
+ /* Return size of the largest file that is not considered oversized */
3331
+ return strtoll(db_get("large-file-size","20000000"),0,0);
3332
+}
33293333
void db_set_int(const char *zName, int value, int globalFlag){
33303334
db_assert_protection_off_or_not_sensitive(zName);
33313335
db_unprotect(PROTECT_CONFIG);
33323336
if( globalFlag ){
33333337
db_swap_connections();
@@ -4395,10 +4399,17 @@
43954399
** A shell command used to launch your preferred
43964400
** web browser when given a URL as an argument.
43974401
** Defaults to "start" on windows, "open" on Mac,
43984402
** and "firefox" on Unix.
43994403
*/
4404
+/*
4405
+** SETTING: large-file-size width=10 default=200000000
4406
+** Fossil considers any file whose size is greater than this value
4407
+** to be a "large file". Fossil might issue warnings if you try to
4408
+** "add" or "commit" a "large file". Set this value to 0 or less
4409
+** to disable all such warnings.
4410
+*/
44004411
44014412
/*
44024413
** Look up a control setting by its name. Return a pointer to the Setting
44034414
** object, or NULL if there is no such setting.
44044415
**
44054416
--- src/db.c
+++ src/db.c
@@ -3324,10 +3324,14 @@
3324 }
3325 db_reset(&q2);
3326 }
3327 return v;
3328 }
 
 
 
 
3329 void db_set_int(const char *zName, int value, int globalFlag){
3330 db_assert_protection_off_or_not_sensitive(zName);
3331 db_unprotect(PROTECT_CONFIG);
3332 if( globalFlag ){
3333 db_swap_connections();
@@ -4395,10 +4399,17 @@
4395 ** A shell command used to launch your preferred
4396 ** web browser when given a URL as an argument.
4397 ** Defaults to "start" on windows, "open" on Mac,
4398 ** and "firefox" on Unix.
4399 */
 
 
 
 
 
 
 
4400
4401 /*
4402 ** Look up a control setting by its name. Return a pointer to the Setting
4403 ** object, or NULL if there is no such setting.
4404 **
4405
--- src/db.c
+++ src/db.c
@@ -3324,10 +3324,14 @@
3324 }
3325 db_reset(&q2);
3326 }
3327 return v;
3328 }
3329 i64 db_large_file_size(void){
3330 /* Return size of the largest file that is not considered oversized */
3331 return strtoll(db_get("large-file-size","20000000"),0,0);
3332 }
3333 void db_set_int(const char *zName, int value, int globalFlag){
3334 db_assert_protection_off_or_not_sensitive(zName);
3335 db_unprotect(PROTECT_CONFIG);
3336 if( globalFlag ){
3337 db_swap_connections();
@@ -4395,10 +4399,17 @@
4399 ** A shell command used to launch your preferred
4400 ** web browser when given a URL as an argument.
4401 ** Defaults to "start" on windows, "open" on Mac,
4402 ** and "firefox" on Unix.
4403 */
4404 /*
4405 ** SETTING: large-file-size width=10 default=200000000
4406 ** Fossil considers any file whose size is greater than this value
4407 ** to be a "large file". Fossil might issue warnings if you try to
4408 ** "add" or "commit" a "large file". Set this value to 0 or less
4409 ** to disable all such warnings.
4410 */
4411
4412 /*
4413 ** Look up a control setting by its name. Return a pointer to the Setting
4414 ** object, or NULL if there is no such setting.
4415 **
4416

Keyboard Shortcuts

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