2016-06-03 21:00:57 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
. "test/testlib.sh"
|
|
|
|
|
|
|
|
begin_test "unlocking a lock by path"
|
|
|
|
(
|
|
|
|
set -e
|
|
|
|
|
2016-06-03 21:05:55 +00:00
|
|
|
setup_remote_repo_with_file "unlock_by_path" "c.dat"
|
2016-06-03 21:00:57 +00:00
|
|
|
|
2016-07-21 17:42:41 +00:00
|
|
|
GITLFSLOCKSENABLED=1 git lfs lock "c.dat" | tee lock.log
|
2016-06-03 21:00:57 +00:00
|
|
|
|
|
|
|
id=$(grep -oh "\((.*)\)" lock.log | tr -d "()")
|
|
|
|
assert_server_lock $id
|
|
|
|
|
2016-07-21 17:42:41 +00:00
|
|
|
GITLFSLOCKSENABLED=1 git lfs unlock "c.dat" 2>&1 | tee unlock.log
|
2016-06-03 21:00:57 +00:00
|
|
|
refute_server_lock $id
|
|
|
|
)
|
|
|
|
end_test
|
|
|
|
|
|
|
|
begin_test "unlocking a lock by id"
|
|
|
|
(
|
|
|
|
set -e
|
|
|
|
|
2016-06-03 21:05:55 +00:00
|
|
|
setup_remote_repo_with_file "unlock_by_id" "d.dat"
|
2016-06-03 21:00:57 +00:00
|
|
|
|
2016-07-21 17:42:41 +00:00
|
|
|
GITLFSLOCKSENABLED=1 git lfs lock "d.dat" | tee lock.log
|
2016-06-03 21:00:57 +00:00
|
|
|
|
|
|
|
id=$(grep -oh "\((.*)\)" lock.log | tr -d "()")
|
|
|
|
assert_server_lock $id
|
|
|
|
|
2016-07-21 17:42:41 +00:00
|
|
|
GITLFSLOCKSENABLED=1 git lfs unlock --id="$id" 2>&1 | tee unlock.log
|
2016-06-03 21:00:57 +00:00
|
|
|
refute_server_lock $id
|
|
|
|
)
|
|
|
|
end_test
|
|
|
|
|
|
|
|
begin_test "unlocking a lock without sufficient info"
|
|
|
|
(
|
|
|
|
set -e
|
|
|
|
|
2016-06-03 21:05:55 +00:00
|
|
|
setup_remote_repo_with_file "unlock_ambiguous" "e.dat"
|
2016-06-03 21:00:57 +00:00
|
|
|
|
2016-07-21 17:42:41 +00:00
|
|
|
GITLFSLOCKSENABLED=1 git lfs lock "e.dat" | tee lock.log
|
2016-06-03 21:00:57 +00:00
|
|
|
|
|
|
|
id=$(grep -oh "\((.*)\)" lock.log | tr -d "()")
|
|
|
|
assert_server_lock $id
|
|
|
|
|
2016-07-21 17:42:41 +00:00
|
|
|
GITLFSLOCKSENABLED=1 git lfs unlock 2>&1 | tee unlock.log
|
2016-06-03 21:00:57 +00:00
|
|
|
grep "Usage: git lfs unlock" unlock.log
|
|
|
|
assert_server_lock $id
|
|
|
|
)
|
|
|
|
end_test
|