Ticket UUID: | 36cb6b45fd9d31f6bc4bd4ad87f18aad50e5bce9 | ||
Title: | in windows, fossil allows addition of the same file twice | ||
Status: | Open | Type: | Feature_Request |
Severity: | Minor | Priority: | |
Subsystem: | Resolution: | Open | |
Last Modified: | 2010-01-20 21:34:23 | ||
Version Found In: | 076f7adff2 | ||
Description & Comments: | |||
in windows, the file system is case insensitive. fossil allows the addition of the same file twice differing only by case. both files show up in the ui but technically they are versioned separately even though they are the same file on disk; it is unclear which artifact dominates on fossil open/update.
PS C:\fossil> fossil new test.f project-id: 24ac0462f2082e82bcdf2de26ceb3c38aaffcfe4 server-id: 0b879e4b0baa36b4da40631bf54866f3ae825323 admin-user: rwilso20 (initial password is "ab6ad5") PS C:\fossil> md test PS C:\fossil> cd test PS C:\fossil\test> fossil open ..\test.f PS C:\fossil\test> notepad camelCase.txt PS C:\fossil\test> fossil add camelCase.txt ADDED camelCase.txt PS C:\fossil\test> fossil add camelcase.txt ADDED camelcase.txt PS C:\fossil\test> fossil commit notepad "C:/fossil/test/ci-comment-09044B4972BB.txt" 'gpg' is not recognized as an internal or external command, operable program or batch file. unable to sign manifest. continue [y/N]? y New_Version: b06866048f0a6cdf50573ef9e7767bb6fa4449db PS C:\fossil\test> fossil ls UNCHANGED camelCase.txt UNCHANGED camelcase.txt PS C:\fossil\test> fossil ver This is fossil version [076f7adff2] 2009-10-13 16:25:41 UTC PS C:\fossil\test> drh added on 2009-10-16 14:36:30: I suppose it does make sense to issue warnings if fossil detects possible conflicts in filenames. This can be done easily enough for ASCII. But because the problem is all but unsolvable for full unicode, the change should be to add warnings only, and then only for ASCII. Some users may actually want to store files whose names differ only in case and we don't want to have to go through all of the complication to try to figure out unicode case folding. I am changing this ticket to a feature request. jeremy_c added on 2010-01-05 14:09:04: anonymous claiming to be Jose F. Gimenez added on 2010-01-16 18:33:47: I'm evaluating fossil to replace cvs for all my repositories, and I've stumbled in this problem. Since fossil has no gui actualy (similar to tortoiseXXX), and it has to be used by typing commands from the command line, it's very very easy to add a file twice or more times accidentaly. Also, to manage any versioned file you must type its name exactly as it was added or it cannot be found. So it indeed become a very big problem for those of us that work in windows or any other case-insensitive os. IMHO, a possible solution could be to allow configure the repository as case sensitive or insensitive. So, who works in a case-sensitive os don't have to renunce to the actual behaviour, while the windows (only) users will be happy. anonymous added on 2010-01-16 18:39:58: anonymous added on 2010-01-20 05:21:49: anonymous claiming to be ramsan added on 2010-01-20 12:38:01: PS C:\fossil\test> notepad camelCase.txt PS C:\fossil\test> fossil add camelCase.txt ADDED camelCase.txt PS C:\fossil\test> fossil add camelcase.txt ADDED camelcase.txtCommand "fossil add ..." needs to ask the operating system if file 'camelcase.txt' exist. If it does not exist, the command fails. When doing this request, fossil can ask the operating system for the exact name of the file. In this case, the OS would answer "camelCase.txt". Then, it would be easy to detect that "camelCase.txt" has already been added and raise an error. drh added on 2010-01-20 13:36:53: anonymous claiming to be ramsan added on 2010-01-20 15:10:26: file tail [file normalize camelcase.txt] ---> camelCase.txtTo do so in C, it is necessary to review the TCL C source code. rwilson added on 2010-01-20 15:36:36: i just tested it myself and it works. rwilson added on 2010-01-20 17:49:36: drh added on 2010-01-20 18:38:34: ron added on 2010-01-20 18:42:03: What happens when the repo is shared between Linux and Windows users, and the Linux users add two files, say "makefile" and "Makefile"? When the Windows user does an 'update', she will get one of the files, since Windows doesn't distinguish case (neither does OS/X). So one file will be missing on Windows. Perhaps it makes sense to issue a notice to the Windows user in that case? anonymous claiming to be Jose F. Gimenez added on 2010-01-20 19:26:25: BOOL GetRealFilename( const char * szFilename, char * szRealFilename ) { char szTempFilename[ MAX_PATH ]; if( GetShortPathName( szFilename, szTempFilename, MAX_PATH ) ) if( GetLongPathName( szTempFilename, szRealFilename, MAX_PATH ) ) return TRUE; return FALSE; }Also, it allows to check the existance of a file, since it returns FALSE if the file doesn't exist. But that doesn't fix the problem at 100%. You could rename a file in your working directory, changing only case, and get again in a trouble. So, the check have to be done in the repository. The drh fix solves the most cases, although it doesn't deal with non ascii chars. Thanks, however! rwilson added on 2010-01-20 21:34:23: drh - jose's solution only requires kernel32.lib, not psapi.lib. |