Fixes issue #1072. Currently, `git-lfs` installs filters which misinterpret
filenames with leading dashes as command line flags. Separate paths with a
double dash (`--`) when installing filters so these files are handled
properly.
The failing test now passes:
```
$ ./test/test-unusual-filenames.sh
...
test: push unusually named files ... OK
test: pull unusually named files ... OK
```
The old `Filter` type represented a far too specific type of attribute.
Instead, a generic alternative called `Attribute` is favored, which more more
closely matches the type of structure defined in
http://git-scm.com/docs/gitattributes.
This commit introduces two new types into the API: Hook, and Filter.
Both `Hook` and `Filter` are abstractions built on Git hooks and filters
respectively. Each type knows how to install and uninstall itself. These
processes are utilized by the setup method in the `lfs` package, and the
appropriate calls have been updated in the init and uninit commands.
These abstractions were introduced to make adding/removing required filters and
hooks easier for future projects, including the migration away from the smudge
filter.
Eventually it seems appropriate to move both new types into the `git` package,
as opposed to the `lfs` package. At the time of writing this commit, there is
some coupling against state defined in the `lfs` package (i.e., whether or not
we're currently in a git repo, the local working directory, etc). At somepoint
it would be nice to remove that coupling and move these new types into the
`git` package.
If git-lfs does not exist (e.g. it has been uninstalled) the pre-push
hook should still exit cleanly so the push can continue. The script will
output a warning stating that the repo has been set up for Git LFS but
that it is not installed.
I needed some extra time to understand what was happening. In my
opinion, the control flow is easier to follow when checking for
err != nil, as this is the convention in go.