| | @@ -895,11 +895,11 @@ |
| 895 | 895 | */ |
| 896 | 896 | static int commit_warning( |
| 897 | 897 | Blob *p, /* The content of the file being committed. */ |
| 898 | 898 | int crnlOk, /* Non-zero if CR/NL warnings should be disabled. */ |
| 899 | 899 | int binOk, /* Non-zero if binary warnings should be disabled. */ |
| 900 | | - int unicodeOk, /* Non-zero if unicode warnings should be disabled. */ |
| 900 | + int encodingOk, /* Non-zero if encoding warnings should be disabled. */ |
| 901 | 901 | const char *zFilename /* The full name of the file being committed. */ |
| 902 | 902 | ){ |
| 903 | 903 | int eType; /* return value of looks_like_utf8/utf16() */ |
| 904 | 904 | int fUnicode; /* return value of starts_with_utf16_bom() */ |
| 905 | 905 | char *zMsg; /* Warning message */ |
| | @@ -909,44 +909,50 @@ |
| 909 | 909 | if( allOk ) return 0; |
| 910 | 910 | fUnicode = starts_with_utf16_bom(p, 0); |
| 911 | 911 | eType = fUnicode ? looks_like_utf16(p) : looks_like_utf8(p); |
| 912 | 912 | if( eType==0 || eType==-1 || fUnicode ){ |
| 913 | 913 | const char *zWarning; |
| 914 | + const char *zDisable; |
| 914 | 915 | const char *zConvert = "c=convert/"; |
| 915 | 916 | Blob ans; |
| 916 | 917 | char cReply; |
| 917 | 918 | |
| 918 | 919 | if( eType==-1 && fUnicode ){ |
| 919 | | - if ( crnlOk && unicodeOk ){ |
| 920 | | - return 0; /* We don't want Unicode/CR/NL warnings for this file. */ |
| 920 | + if ( crnlOk && encodingOk ){ |
| 921 | + return 0; /* We don't want CR/NL and Unicode warnings for this file. */ |
| 921 | 922 | } |
| 922 | | - zWarning = "Unicode and CR/NL line endings"; |
| 923 | + zWarning = "CR/NL line endings and Unicode"; |
| 924 | + zDisable = "\"crnl-glob\" and \"encoding-glob\" settings"; |
| 923 | 925 | }else if( eType==-1 ){ |
| 924 | 926 | if( crnlOk ){ |
| 925 | 927 | return 0; /* We don't want CR/NL warnings for this file. */ |
| 926 | 928 | } |
| 927 | 929 | zWarning = "CR/NL line endings"; |
| 930 | + zDisable = "\"crnl-glob\" setting"; |
| 928 | 931 | }else if( eType==0 ){ |
| 929 | 932 | if( binOk ){ |
| 930 | 933 | return 0; /* We don't want binary warnings for this file. */ |
| 931 | 934 | } |
| 932 | 935 | zWarning = "binary data"; |
| 936 | + zDisable = "\"binary-glob\" setting"; |
| 933 | 937 | zConvert = ""; /* We cannot convert binary files. */ |
| 934 | 938 | }else{ |
| 935 | | - if ( unicodeOk ){ |
| 936 | | - return 0; /* We don't want unicode warnings for this file. */ |
| 939 | + if ( encodingOk ){ |
| 940 | + return 0; /* We don't want encoding warnings for this file. */ |
| 937 | 941 | } |
| 938 | 942 | zWarning = "Unicode"; |
| 943 | + zDisable = "\"encoding-glob\" setting"; |
| 939 | 944 | #ifndef _WIN32 |
| 940 | 945 | zConvert = ""; /* On Unix, we cannot easily convert Unicode files. */ |
| 941 | 946 | #endif |
| 942 | 947 | } |
| 943 | 948 | file_relative_name(zFilename, &fname, 0); |
| 944 | 949 | blob_zero(&ans); |
| 945 | 950 | zMsg = mprintf( |
| 946 | | - "%s contains %s. commit anyhow (a=all/%sy/N)? ", |
| 947 | | - blob_str(&fname), zWarning, zConvert); |
| 951 | + "%s contains %s. Use --no-warnings or the %s to disable this warning.\n" |
| 952 | + "Commit anyhow (a=all/%sy/N)? ", |
| 953 | + blob_str(&fname), zWarning, zDisable, zConvert); |
| 948 | 954 | prompt_user(zMsg, &ans); |
| 949 | 955 | fossil_free(zMsg); |
| 950 | 956 | cReply = blob_str(&ans)[0]; |
| 951 | 957 | if( cReply=='a' || cReply=='A' ){ |
| 952 | 958 | allOk = 1; |
| | @@ -1314,25 +1320,25 @@ |
| 1314 | 1320 | "SELECT id, %Q || pathname, mrid, %s, chnged, %s, %s FROM vfile " |
| 1315 | 1321 | "WHERE chnged==1 AND NOT deleted AND is_selected(id)", |
| 1316 | 1322 | g.zLocalRoot, |
| 1317 | 1323 | glob_expr("pathname", db_get("crnl-glob","")), |
| 1318 | 1324 | glob_expr("pathname", db_get("binary-glob","")), |
| 1319 | | - glob_expr("pathname", db_get("unicode-glob","")) |
| 1325 | + glob_expr("pathname", db_get("encoding-glob","")) |
| 1320 | 1326 | ); |
| 1321 | 1327 | while( db_step(&q)==SQLITE_ROW ){ |
| 1322 | 1328 | int id, rid; |
| 1323 | 1329 | const char *zFullname; |
| 1324 | 1330 | Blob content; |
| 1325 | | - int crnlOk, binOk, unicodeOk, chnged; |
| 1331 | + int crnlOk, binOk, encodingOk, chnged; |
| 1326 | 1332 | |
| 1327 | 1333 | id = db_column_int(&q, 0); |
| 1328 | 1334 | zFullname = db_column_text(&q, 1); |
| 1329 | 1335 | rid = db_column_int(&q, 2); |
| 1330 | 1336 | crnlOk = db_column_int(&q, 3); |
| 1331 | 1337 | chnged = db_column_int(&q, 4); |
| 1332 | 1338 | binOk = db_column_int(&q, 5); |
| 1333 | | - unicodeOk = db_column_int(&q, 6); |
| 1339 | + encodingOk = db_column_int(&q, 6); |
| 1334 | 1340 | |
| 1335 | 1341 | blob_zero(&content); |
| 1336 | 1342 | if( file_wd_islink(zFullname) ){ |
| 1337 | 1343 | /* Instead of file content, put link destination path */ |
| 1338 | 1344 | blob_read_link(&content, zFullname); |
| | @@ -1340,11 +1346,11 @@ |
| 1340 | 1346 | blob_read_from_file(&content, zFullname); |
| 1341 | 1347 | } |
| 1342 | 1348 | /* Do not emit any warnings when they are disabled. */ |
| 1343 | 1349 | if( !noWarningFlag ){ |
| 1344 | 1350 | abortCommit |= commit_warning(&content, crnlOk, binOk, |
| 1345 | | - unicodeOk, zFullname); |
| 1351 | + encodingOk, zFullname); |
| 1346 | 1352 | } |
| 1347 | 1353 | if( chnged==1 && contains_merge_marker(&content) ){ |
| 1348 | 1354 | Blob fname; /* Relative pathname of the file */ |
| 1349 | 1355 | |
| 1350 | 1356 | nConflict++; |
| 1351 | 1357 | |