git-lfs/test/test-unusual-filenames.sh
epriestley 157751020b Add a failing test for filenames starting with dashes
See issue #1072 for details.

```
git-lfs/ $ ./test/test-unusual-filenames.sh
...
test: push unusually named files ...                               FAILED
...
    [master (root-commit) 0bec008] add files
     2 files changed, 1 insertion(+)
     create mode 100644 -dash.dat
     create mode 100644 .gitattributes
...
    Error: unknown shorthand flag: 'd' in -dash.dat
```
2016-03-17 14:45:50 -07:00

40 lines
673 B
Bash
Executable File

#!/usr/bin/env bash
. "test/testlib.sh"
reponame="$(basename "$0" ".sh")"
# Leading dashes may be misinterpreted as flags if commands don't use "--"
# before paths.
name1='-dash.dat'
contents1='leading dash'
begin_test "push unusually named files"
(
set -e
setup_remote_repo "$reponame"
clone_repo "$reponame" repo
git lfs track "*.dat"
echo "$content1" > "$name1"
git add -- .gitattributes *.dat
git commit -m "add files"
git push origin master | tee push.log
grep "Git LFS: (1 of 1 files)" push.log
)
end_test
begin_test "pull unusually named files"
(
set -e
clone_repo "$reponame" clone
grep "Downloading $name1" clone.log
)
end_test