Index: src/checkin.c ================================================================== --- src/checkin.c +++ src/checkin.c @@ -895,11 +895,11 @@ */ static int commit_warning( 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. */ + int encodingOk, /* Non-zero if encoding 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 */ @@ -909,44 +909,50 @@ if( allOk ) return 0; fUnicode = starts_with_utf16_bom(p, 0); eType = fUnicode ? looks_like_utf16(p) : looks_like_utf8(p); if( eType==0 || eType==-1 || fUnicode ){ const char *zWarning; + const char *zDisable; const char *zConvert = "c=convert/"; Blob ans; char cReply; if( eType==-1 && fUnicode ){ - if ( crnlOk && unicodeOk ){ - return 0; /* We don't want Unicode/CR/NL warnings for this file. */ + if ( crnlOk && encodingOk ){ + return 0; /* We don't want CR/NL and Unicode warnings for this file. */ } - zWarning = "Unicode and CR/NL line endings"; + zWarning = "CR/NL line endings and Unicode"; + zDisable = "\"crnl-glob\" and \"encoding-glob\" settings"; }else if( eType==-1 ){ if( crnlOk ){ return 0; /* We don't want CR/NL warnings for this file. */ } zWarning = "CR/NL line endings"; + zDisable = "\"crnl-glob\" setting"; }else if( eType==0 ){ if( binOk ){ return 0; /* We don't want binary warnings for this file. */ } zWarning = "binary data"; + zDisable = "\"binary-glob\" setting"; zConvert = ""; /* We cannot convert binary files. */ }else{ - if ( unicodeOk ){ - return 0; /* We don't want unicode warnings for this file. */ + if ( encodingOk ){ + return 0; /* We don't want encoding warnings for this file. */ } zWarning = "Unicode"; + zDisable = "\"encoding-glob\" setting"; #ifndef _WIN32 zConvert = ""; /* On Unix, we cannot easily convert Unicode files. */ #endif } file_relative_name(zFilename, &fname, 0); blob_zero(&ans); zMsg = mprintf( - "%s contains %s. commit anyhow (a=all/%sy/N)? ", - blob_str(&fname), zWarning, zConvert); + "%s contains %s. Use --no-warnings or the %s to disable this warning.\n" + "Commit anyhow (a=all/%sy/N)? ", + blob_str(&fname), zWarning, zDisable, zConvert); prompt_user(zMsg, &ans); fossil_free(zMsg); cReply = blob_str(&ans)[0]; if( cReply=='a' || cReply=='A' ){ allOk = 1; @@ -1314,25 +1320,25 @@ "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","")), - glob_expr("pathname", db_get("unicode-glob","")) + glob_expr("pathname", db_get("encoding-glob","")) ); while( db_step(&q)==SQLITE_ROW ){ int id, rid; const char *zFullname; Blob content; - int crnlOk, binOk, unicodeOk, chnged; + int crnlOk, binOk, encodingOk, 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 = db_column_int(&q, 5); - unicodeOk = db_column_int(&q, 6); + encodingOk = 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); @@ -1340,11 +1346,11 @@ blob_read_from_file(&content, zFullname); } /* Do not emit any warnings when they are disabled. */ if( !noWarningFlag ){ abortCommit |= commit_warning(&content, crnlOk, binOk, - unicodeOk, zFullname); + encodingOk, zFullname); } if( chnged==1 && contains_merge_marker(&content) ){ Blob fname; /* Relative pathname of the file */ nConflict++; Index: src/configure.c ================================================================== --- src/configure.c +++ src/configure.c @@ -103,11 +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 }, + { "encoding-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 @@ -2091,11 +2091,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, "" }, + { "encoding-glob", 0, 40, 1, "" }, { "web-browser", 0, 32, 0, "" }, { "white-foreground", 0, 0, 0, "off" }, { 0,0,0,0,0 } }; @@ -2179,10 +2179,16 @@ ** ** empty-dirs A comma or newline-separated list of pathnames. On ** (versionable) update and checkout commands, if no file or directory ** exists with that name, an empty directory will be ** created. +** +** encoding-glob The VALUE is a comma or newline-separated list of GLOB +** (versionable) patterns specifying files that the "commit" command will +** ignore when issuing warnings about text files that may +** use another encoding than ASCII or UTF-8. Set to "*" +** to disable encoding checking. ** ** gdiff-command External command to run when performing a graphical ** diff. If undefined, text diff will be used. ** ** gmerge-command A graphical merge conflict resolver command operating @@ -2278,15 +2284,10 @@ ** ** 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 GLOB -** (versionable) patterns specifying files that the "commit" command will -** ignore when issuing warnings about text files that may -** contain Unicode. 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. **