| 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | . "$(dirname "$0")/testlib.sh" |
| 4 | |
| 5 | ensure_git_version_isnt $VERSION_LOWER "2.1.0" |
| 6 | |
| 7 | begin_test "track (--no-modify-attrs)" |
| 8 | ( |
| 9 | set -e |
| 10 | |
| 11 | reponame="track-no-modify-attrs" |
| 12 | git init "$reponame" |
| 13 | cd "$reponame" |
| 14 | |
| 15 | echo "contents" > a.dat |
| 16 | git add a.dat |
| 17 | |
| 18 | # Git assumes that identical results from `stat(1)` between the index and |
| 19 | # working copy are stat dirty. To prevent this, wait at least one second to |
| 20 | # yield different `stat(1)` results. |
| 21 | sleep 1 |
| 22 | |
| 23 | git commit -m "add a.dat" |
| 24 | |
| 25 | echo "*.dat filter=lfs diff=lfs merge=lfs -text" > .gitattributes |
| 26 | |
| 27 | git add .gitattributes |
| 28 | git commit -m "asdf" |
| 29 | |
| 30 | [ -z "$(git status --porcelain)" ] |
| 31 | |
| 32 | git lfs track --no-modify-attrs "*.dat" |
| 33 | |
| 34 | [ " M a.dat" = "$(git status --porcelain)" ] |
| 35 | ) |
| 36 | end_test |
| 37 | |
| 38 | begin_test "track (--dry-run)" |
| 39 | ( |
| 40 | set -e |
| 41 | |
| 42 | reponame="track-dry-run" |
| 43 | git init "$reponame" |
| 44 | cd "$reponame" |
| 45 | |
| 46 | git lfs track --dry-run "*.dat" |
| 47 | |
| 48 | echo "contents" > a.dat |
| 49 | git add a.dat |
| 50 | |
| 51 | git commit -m "add a.dat" |
| 52 | refute_pointer "main" "a.dat" |
| 53 | ) |
| 54 | end_test |