2016-06-03 16:36:26 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
. "test/testlib.sh"
|
|
|
|
|
|
|
|
begin_test "creating a lock"
|
|
|
|
(
|
|
|
|
set -e
|
|
|
|
|
|
|
|
setup_remote_repo_with_file "lock_create_simple" "a.dat"
|
|
|
|
|
2016-07-21 16:07:06 +00:00
|
|
|
GITLFSLOCKSENABLED=1 git lfs lock "a.dat" | tee lock.log
|
2016-06-03 16:36:26 +00:00
|
|
|
grep "'a.dat' was locked" lock.log
|
|
|
|
|
|
|
|
id=$(grep -oh "\((.*)\)" lock.log | tr -d "()")
|
|
|
|
assert_server_lock $id
|
|
|
|
)
|
|
|
|
end_test
|
|
|
|
|
|
|
|
begin_test "locking a previously locked file"
|
|
|
|
(
|
|
|
|
set -e
|
|
|
|
|
2016-06-03 21:05:55 +00:00
|
|
|
setup_remote_repo_with_file "lock_create_previously_created" "b.dat"
|
2016-06-03 16:36:26 +00:00
|
|
|
|
2016-07-21 16:07:06 +00:00
|
|
|
GITLFSLOCKSENABLED=1 git lfs lock "b.dat" | tee lock.log
|
2016-06-03 21:05:55 +00:00
|
|
|
grep "'b.dat' was locked" lock.log
|
2016-06-03 16:36:26 +00:00
|
|
|
|
|
|
|
id=$(grep -oh "\((.*)\)" lock.log | tr -d "()")
|
|
|
|
assert_server_lock $id
|
|
|
|
|
2016-07-21 16:07:06 +00:00
|
|
|
grep "lock already created" <(GITLFSLOCKSENABLED=1 git lfs lock "b.dat" 2>&1)
|
2016-06-03 16:36:26 +00:00
|
|
|
)
|
|
|
|
end_test
|
2016-06-04 17:25:02 +00:00
|
|
|
|
|
|
|
begin_test "locking a directory"
|
|
|
|
(
|
|
|
|
set -e
|
|
|
|
|
|
|
|
reponame="locking_directories"
|
|
|
|
setup_remote_repo "remote_$reponame"
|
|
|
|
clone_repo "remote_$reponame" "clone_$reponame"
|
|
|
|
|
|
|
|
git lfs track "*.dat"
|
|
|
|
mkdir dir
|
|
|
|
echo "a" > dir/a.dat
|
|
|
|
|
|
|
|
git add dir/a.dat .gitattributes
|
|
|
|
|
|
|
|
git commit -m "add dir/a.dat" | tee commit.log
|
|
|
|
grep "master (root-commit)" commit.log
|
|
|
|
grep "2 files changed" commit.log
|
|
|
|
grep "create mode 100644 dir/a.dat" commit.log
|
|
|
|
grep "create mode 100644 .gitattributes" commit.log
|
|
|
|
|
|
|
|
git push origin master 2>&1 | tee push.log
|
|
|
|
grep "master -> master" push.log
|
|
|
|
|
2016-07-21 16:07:06 +00:00
|
|
|
GITLFSLOCKSENABLED=1 git lfs lock ./dir/ 2>&1 | tee lock.log
|
2016-06-04 17:25:02 +00:00
|
|
|
grep "cannot lock directory" lock.log
|
|
|
|
)
|
|
|
|
end_test
|