I discovered a little quirk of TextMate this afternoon that cost me several hours of work.
I had a file within a project called "distributions.py", and wanted to make a new file called "Distributions.py" to experiment with a few things. When I created this file, it generated a new file, but rather than the usual template, it contained the contents of distributions.py. Fine, I thought, I was going to copy some of the contents of "distributions.py" over anyway. I went ahead and heavily edited Distributions.py, including deleting much of the original contents.
I was shocked to find that when I went back to the original file, all the editing that I had done in the new file was mirrored in the second! I had done enough editing that I was unable to undo changes to get most of it back. Several hours of work -- gone.
Why on earth did creating a *new* file in a project apparently just create some sort of symbolic link to an existing file?? 2 different files "Distributions.py" and "distributions.py" both appeared in the project list, and both had their own tabs. Does this have something to do with having files that differ only in case? Very frustrating.
On Aug 16, 2007, at 2:28 PM, Chris Fonnesbeck wrote:
I discovered a little quirk of TextMate this afternoon that cost me several hours of work.
I had a file within a project called "distributions.py", and wanted to make a new file called "Distributions.py" to experiment with a few things. When I created this file, it generated a new file, but rather than the usual template, it contained the contents of distributions.py. Fine, I thought, I was going to copy some of the contents of "distributions.py" over anyway. I went ahead and heavily edited Distributions.py, including deleting much of the original contents.
I was shocked to find that when I went back to the original file, all the editing that I had done in the new file was mirrored in the second! I had done enough editing that I was unable to undo changes to get most of it back. Several hours of work -- gone.
Why on earth did creating a *new* file in a project apparently just create some sort of symbolic link to an existing file?? 2 different files "Distributions.py" and "distributions.py" both appeared in the project list, and both had their own tabs. Does this have something to do with having files that differ only in case? Very frustrating.
I can confirm this behavior, and I would definitely consider it a bug. You might want to add your comments to this ticket, which seems to be relevant:
http://macromates.com/ticket/show?ticket_id=00157F1A
Haris Skiadas Department of Mathematics and Computer Science Hanover College
Chris I believe this is the fault of the Mac OS. For historical reasons I think the operating system will by default treat files that differ only in case as the same.
Here is a simple test....
Open the Terminal.
Create a file called "junk" with the touch command:
$ touch junk
Now create a file called "Junk" with the touch command:
$ touch Junk
Now check your results:
$ ls -l
On my mac I just did this and the ls command revealed just the original (all lower case) file name..
--gordy
On Aug 16, 2007, at 13:28, Chris Fonnesbeck wrote:
Why on earth did creating a *new* file in a project apparently just create some sort of symbolic link to an existing file?? 2 different files "Distributions.py" and "distributions.py" both appeared in the project list, and both had their own tabs. Does this have something to do with having files that differ only in case? Very frustrating.
On Aug 16, 2007, at 2:51 PM, Gordon Tillman wrote:
Chris I believe this is the fault of the Mac OS. For historical reasons I think the operating system will by default treat files that differ only in case as the same.
The problem, in my opinion, is not that there aren't two files, but that TextMate *shows* you two files. I.e. you end up having two tabs in the TextMate project, one for a file named junk and one for the file named Junk. The contents of those two document windows are always the same, but the documents seem distinct in many ways. For instance, if you edit one of the files, it is only that file that is marked as "dirty", and not the other one as well.
So the point is that TextMate should not be allowing you to "create" that new file.
Haris Skiadas Department of Mathematics and Computer Science Hanover College
On Aug 16, 2007, at 2:38 PM, Chris Fonnesbeck wrote:
I had a file within a project called "distributions.py", and wanted to make a new file called "Distributions.py" to experiment with a few things.
HFS/HFS+ is traditionally a case-preserving, but case-insensitive file-system:
http://en.wikipedia.org/wiki/Case_preservation
As of 10.4, HFS+ supports case-sensitivity. When you create a new- volume, you can enable case-sensitivity, but this is not the default. As well, my guess is that if you tried to install OS X on a case- sensitive HFS+ volume, it would break quite a few applications that simply haven't been QA'd in such a scenario.
This isn't a fault of TextMate.
FWIW, NTFS is the same way. This is likely to catch Unix-geeks by surprise since ufs and other unix-like file-systems (xfs, zfs, ext2/ ext3, reiserfs, etc) are all case-sensitive.
Feel free to fire up Disk Utility, create a disk image, then click on the Erase tab and notice the following options:
j.
On Aug 16, 2007, at 2:38 PM, Chris Fonnesbeck wrote:
Why on earth did creating a *new* file in a project apparently just create some sort of symbolic link to an existing file?? 2 different files "Distributions.py" and "distributions.py" both appeared in the project list, and both had their own tabs. Does this have something to do with having files that differ only in case? Very frustrating.
Hmm, the fact that I can do this seems like a bug:
I just created a new project, then selected "New File..." multiple times, providing the same name each time.
Your situation is slightly different, but arguably TextMate should not allow the same underlying file to appear in the drawer more than once.
j.
This has happened to me before, too. The trickier thing is to trying to remove the file that is some sort of pointer...you basically can't. If you delete either one of the files, it removes both from the list.
-James
On Aug 16, 2007, at 3:43 PM, Jay Soffian wrote:
On Aug 16, 2007, at 2:38 PM, Chris Fonnesbeck wrote:
Why on earth did creating a *new* file in a project apparently just create some sort of symbolic link to an existing file?? 2 different files "Distributions.py" and "distributions.py" both appeared in the project list, and both had their own tabs. Does this have something to do with having files that differ only in case? Very frustrating.
Hmm, the fact that I can do this seems like a bug:
<Picture 2.png> I just created a new project, then selected "New File..." multiple times, providing the same name each time.
Your situation is slightly different, but arguably TextMate should not allow the same underlying file to appear in the drawer more than once.
j. ______________________________________________________________________ For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
On Aug 16, 2007, at 3:43 PM, Jay Soffian wrote:
[...] Your situation is slightly different, but arguably TextMate should not allow the same underlying file to appear in the drawer more than once.
Well, presently it allows people to add all they want to the drawer, so that would include adding the same file multiple times -- but in the future it will be file browser only.
As for identical files or not -- some file systems are case sensitive, making two files with different case different. TM in 1.x uses the path to see if two files are identical, and it does not know if the underlying file system is case sensitive or not. In the future it will use inodes, which will also handle symbolic links.
On Aug 24, 2007, at 12:32 PM, Allan Odgaard wrote:
In the future it will use inodes, which will also handle symbolic links.
I'm sure you know this, but typically you'd use the (device_id, inode) pair to ensure uniqueness across filesystems.
j.