resmo/git-ftp — pull request #215 by jonathanpatt (2013-02-05 19:11:54+00:00)
Title: Add support for syncing untracked files

This may not be something you're interested in adding, but it's a feature I find incredibly useful, and I think anyone who uses any compiled languages like CoffeeScript, SCSS or LESS would find it useful as well.

This feature allows the pairing of an untracked file to a tracked file. When the tracked file changes, the same change is applied to the untracked file. If you pair the untracked `css/style.css` with the tracked `scss/style.scss`, then make a change to the tracked SCSS file in a commit, the next time you upload via `git-ftp`, `css/style.css` will be uploaded. (It's assumed that you're handling compilation of the included files yourself, either manually or with an automated tool that watches the files and compiles them.) Similarly, if the tracked file is deleted, its paired file is deleted as well—with one caveat:

It's possible to link an untracked file to multiple tracked files. This is necessary for situations where multiple tracked files (e.g. multiple SCSS files) are compiled into a single file (e.g. via a SCSS `@import`), as an edit to or deletion any of the paired tracked files needs to cause the untracked file to upload. If all the paired tracked files are deleted, the untracked file is also deleted.

The feature makes use of a new hidden file, `.git-ftp-include`, and uses the following syntax to pair files, one pair per line:

untracked_file:tracked_file

e.g.:

css/style.css:scss/style.scss

I'm open to any suggestions, including if there are any better names to use for the file, or a better syntax for pairing files. I feel my implementation of checking whether an untracked file should be deleted or uploaded is a bit ugly and hackish and could possibly be improved.

I've used this feature locally for more than a month, in several different forms as I extended and refined it, and I've fixed all the issues I came across, but it wouldn't be harmful to test it further.