3 . "$(dirname "$0")/testlib.sh"
5 begin_test "post-commit"
9 reponame="$(basename "$0" ".sh")"
10 setup_remote_repo "$reponame"
12 clone_repo "$reponame" "$reponame"
14 git lfs track --lockable "*.dat"
15 git lfs track "*.big" # not lockable
16 git add .gitattributes
17 git commit -m "add git attributes"
19 echo "Come with me" > pcfile1.dat
20 echo "and you'll be" > pcfile2.dat
21 echo "in a world" > pcfile3.big
22 echo "of pure imagination" > pcfile4.big
25 git commit -m "Committed large files"
27 # New lockable files should have been made read-only now since not locked
28 refute_file_writeable pcfile1.dat
29 refute_file_writeable pcfile2.dat
30 assert_file_writeable pcfile3.big
31 assert_file_writeable pcfile4.big
33 git push -u origin master
35 # now lock files, then edit
36 git lfs lock pcfile1.dat
37 git lfs lock pcfile2.dat
39 echo "Take a look" > pcfile1.dat
40 echo "and you'll see" > pcfile2.dat
42 git add pcfile1.dat pcfile2.dat
43 git commit -m "Updated"
45 # files should remain writeable since locked
46 assert_file_writeable pcfile1.dat
47 assert_file_writeable pcfile2.dat
52 begin_test "post-commit (locked file outside of LFS)"
56 reponame="post-commit-external"
57 setup_remote_repo "$reponame"
58 clone_repo "$reponame" "$reponame"
62 # This step is intentionally done in two commits, due to a known bug bug in
63 # the post-checkout process LFS performs. It compares changed files from HEAD,
64 # which is an invalid previous state for the initial commit of a repository.
65 echo "*.dat lockable" > .gitattributes
66 git add .gitattributes
67 git commit -m "initial commit"
71 assert_file_writeable a.dat
72 git commit -m "add a.dat"
74 refute_file_writeable a.dat