textmate / rmate

Edit files from an ssh session in TextMate
http://blog.macromates.com/2011/mate-and-rmate/
513 stars 81 forks source link

Copy backup on save #12

Closed sellmerfud closed 11 years ago

sellmerfud commented 11 years ago

This is a proposed solution to issue #11.

Rather than create a hard link to the original, write to a temp file, then copy the temp file over the original, we copy the original, then write the new file contents directly to the original file. This preserves the files owner and group (and permissions).

This allows using rmate to edit files where you are not the owner of the file.

sellmerfud commented 11 years ago

Yes, that is correct. The backup file was not being cleaned up.

sorbits commented 11 years ago

Pulled as 985e6f7...b59aef2 — elaborated in the commit messages.

sorbits commented 11 years ago

It’s btw worth mentioning that this is effectively reverting pull #3. That pull request doesn’t list any issues with the existing strategy, only that the commit improves things.