Index: src/checkin.c ================================================================== --- src/checkin.c +++ src/checkin.c @@ -890,10 +890,11 @@ */ static void commit_warning( const Blob *p, /* The content of the file being committed. */ int crnlOk, /* Non-zero if CR/NL warnings should be disabled. */ int binOk, /* Non-zero if binary warnings should be disabled. */ + int unicodeOk, /* Non-zero if unicode warnings should be disabled. */ const char *zFilename /* The full name of the file being committed. */ ){ int eType; /* return value of looks_like_utf8/utf16() */ int fUnicode; /* return value of starts_with_utf16_bom() */ char *zMsg; /* Warning message */ @@ -907,10 +908,13 @@ const char *zWarning; Blob ans; char cReply; if( eType==-1 && fUnicode ){ + if ( crnlOk && unicodeOk ){ + return; /* We don't want Unicode/CR/NL warnings for this file. */ + } zWarning = "Unicode and CR/NL line endings"; }else if( eType==-1 ){ if( crnlOk ){ return; /* We don't want CR/NL warnings for this file. */ } @@ -919,10 +923,13 @@ if( binOk ){ return; /* We don't want binary warnings for this file. */ } zWarning = "binary data"; }else{ + if ( unicodeOk ){ + return; /* We don't want unicode warnings for this file. */ + } zWarning = "Unicode"; } file_relative_name(zFilename, &fname, 0); blob_zero(&ans); zMsg = mprintf( @@ -1016,10 +1023,11 @@ const char *zComment; /* Check-in comment */ Stmt q; /* Query to find files that have been modified */ char *zUuid; /* UUID of the new check-in */ int noSign = 0; /* True to omit signing the manifest using GPG */ int isAMerge = 0; /* True if checking in a merge */ + int noWarningFlag = 0; /* True if skipping all warnings */ int forceFlag = 0; /* Force a fork */ int forceDelta = 0; /* Force a delta-manifest */ int forceBaseline = 0; /* Force a baseline-manifest */ int allowConflict = 0; /* Allow unresolve merge conflicts */ int binaryOk = 0; /* The --binary-ok flag */ @@ -1054,10 +1062,11 @@ fossil_fatal("cannot use --delta and --baseline together"); } testRun = find_option("test",0,0)!=0; zComment = find_option("comment","m",1); forceFlag = find_option("force", "f", 0)!=0; + noWarningFlag = find_option("no-warnings", 0, 0)!=0; zBranch = find_option("branch","b",1); zColor = find_option("bgcolor",0,1); zBrClr = find_option("branchcolor",0,1); binaryOk = find_option("binary-ok",0,0)!=0; while( (zTag = find_option("tag",0,1))!=0 ){ @@ -1251,36 +1260,42 @@ /* Step 1: Insert records for all modified files into the blob ** table. If there were arguments passed to this command, only ** the identified files are inserted (if they have been modified). */ db_prepare(&q, - "SELECT id, %Q || pathname, mrid, %s, chnged, %s FROM vfile " + "SELECT id, %Q || pathname, mrid, %s, chnged, %s, %s FROM vfile " "WHERE chnged==1 AND NOT deleted AND is_selected(id)", - g.zLocalRoot, glob_expr("pathname", db_get("crnl-glob","")), - glob_expr("pathname", db_get("binary-glob","")) + g.zLocalRoot, + glob_expr("pathname", db_get("crnl-glob","")), + glob_expr("pathname", db_get("binary-glob","")), + glob_expr("pathname", db_get("unicode-glob","")) ); while( db_step(&q)==SQLITE_ROW ){ int id, rid; const char *zFullname; Blob content; - int crnlOk, binOk, chnged; + int crnlOk, binOk, unicodeOk, chnged; id = db_column_int(&q, 0); zFullname = db_column_text(&q, 1); rid = db_column_int(&q, 2); crnlOk = db_column_int(&q, 3); chnged = db_column_int(&q, 4); binOk = binaryOk || db_column_int(&q, 5); + unicodeOk = db_column_int(&q, 6); blob_zero(&content); if( file_wd_islink(zFullname) ){ /* Instead of file content, put link destination path */ blob_read_link(&content, zFullname); }else{ blob_read_from_file(&content, zFullname); } - commit_warning(&content, crnlOk, binOk, zFullname); + /* Do not emit any warnings when they are disabled. */ + if( !noWarningFlag ){ + commit_warning(&content, crnlOk, binOk, unicodeOk, zFullname); + } if( chnged==1 && contains_merge_marker(&content) ){ Blob fname; /* Relative pathname of the file */ nConflict++; file_relative_name(zFullname, &fname, 0); Index: src/configure.c ================================================================== --- src/configure.c +++ src/configure.c @@ -103,10 +103,11 @@ { "project-description", CONFIGSET_PROJ }, { "manifest", CONFIGSET_PROJ }, { "binary-glob", CONFIGSET_PROJ }, { "ignore-glob", CONFIGSET_PROJ }, { "crnl-glob", CONFIGSET_PROJ }, + { "unicode-glob", CONFIGSET_PROJ }, { "empty-dirs", CONFIGSET_PROJ }, { "allow-symlinks", CONFIGSET_PROJ }, { "ticket-table", CONFIGSET_TKT }, { "ticket-common", CONFIGSET_TKT }, Index: src/db.c ================================================================== --- src/db.c +++ src/db.c @@ -2085,10 +2085,11 @@ { "th1-setup", 0, 40, 0, "" }, #ifdef FOSSIL_ENABLE_TCL { "tcl", 0, 0, 0, "off" }, { "tcl-setup", 0, 40, 0, "" }, #endif + { "unicode-glob", 0, 40, 1, "" }, { "web-browser", 0, 32, 0, "" }, { "white-foreground", 0, 0, 0, "off" }, { 0,0,0,0,0 } }; @@ -2262,10 +2263,14 @@ ** is empty and no extra setup is performed. ** ** th1-setup This is the setup script to be evaluated after creating ** and initializing the TH1 interpreter. By default, this ** is empty and no extra setup is performed. +** +** unicode-glob The VALUE is a comma or newline-separated list of +** (versionable) GLOB patterns of files that should not produce a Unicode +** warning. Set to "*" to disable Unicode checking. ** ** web-browser A shell command used to launch your preferred ** web browser when given a URL as an argument. ** Defaults to "start" on windows, "open" on Mac, ** and "firefox" on Unix.