2015-07-30 02:37:31 +00:00
|
|
|
#!/usr/bin/env bash
|
2015-06-20 16:10:54 +00:00
|
|
|
|
|
|
|
. "test/testlib.sh"
|
|
|
|
|
|
|
|
begin_test "fetch"
|
|
|
|
(
|
|
|
|
set -e
|
|
|
|
|
|
|
|
reponame="$(basename "$0" ".sh")"
|
|
|
|
setup_remote_repo "$reponame"
|
|
|
|
|
|
|
|
clone_repo "$reponame" clone
|
|
|
|
|
|
|
|
clone_repo "$reponame" repo
|
|
|
|
|
|
|
|
git lfs track "*.dat" 2>&1 | tee track.log
|
|
|
|
grep "Tracking \*.dat" track.log
|
|
|
|
|
|
|
|
contents="a"
|
|
|
|
contents_oid=$(printf "$contents" | shasum -a 256 | cut -f 1 -d " ")
|
|
|
|
|
|
|
|
printf "$contents" > a.dat
|
|
|
|
git add a.dat
|
|
|
|
git add .gitattributes
|
|
|
|
git commit -m "add a.dat" 2>&1 | tee commit.log
|
|
|
|
grep "master (root-commit)" commit.log
|
|
|
|
grep "2 files changed" commit.log
|
|
|
|
grep "create mode 100644 a.dat" commit.log
|
|
|
|
grep "create mode 100644 .gitattributes" commit.log
|
|
|
|
|
|
|
|
[ "a" = "$(cat a.dat)" ]
|
|
|
|
|
|
|
|
assert_pointer "master" "a.dat" "$contents_oid" 1
|
|
|
|
|
2015-07-06 18:19:18 +00:00
|
|
|
refute_server_object "$reponame" "$contents_oid"
|
2015-06-20 16:10:54 +00:00
|
|
|
|
|
|
|
git push origin master 2>&1 | tee push.log
|
|
|
|
grep "(1 of 1 files)" push.log
|
|
|
|
grep "master -> master" push.log
|
|
|
|
|
2015-07-06 18:19:18 +00:00
|
|
|
assert_server_object "$reponame" "$contents_oid"
|
2015-06-20 16:10:54 +00:00
|
|
|
|
|
|
|
# Add a file in a different branch
|
|
|
|
git checkout -b newbranch
|
|
|
|
b="b"
|
|
|
|
b_oid=$(printf "$b" | shasum -a 256 | cut -f 1 -d " ")
|
|
|
|
printf "$b" > b.dat
|
|
|
|
git add b.dat
|
|
|
|
git commit -m "add b.dat"
|
|
|
|
assert_pointer "newbranch" "b.dat" "$b_oid" 1
|
|
|
|
|
|
|
|
git push origin newbranch
|
2015-07-06 18:19:18 +00:00
|
|
|
assert_server_object "$reponame" "$b_oid"
|
2015-06-20 16:10:54 +00:00
|
|
|
|
|
|
|
# change to the clone's working directory
|
|
|
|
cd ../clone
|
|
|
|
|
|
|
|
git pull 2>&1 | grep "Downloading a.dat (1 B)"
|
|
|
|
|
|
|
|
[ "a" = "$(cat a.dat)" ]
|
|
|
|
|
|
|
|
assert_pointer "master" "a.dat" "$contents_oid" 1
|
|
|
|
|
|
|
|
|
|
|
|
# Remove the working directory and lfs files
|
|
|
|
rm -rf .git/lfs/objects
|
|
|
|
|
|
|
|
git lfs fetch 2>&1 | grep "(1 of 1 files)"
|
|
|
|
|
2015-07-24 14:07:51 +00:00
|
|
|
assert_pointer "master" "a.dat" "$contents_oid" 1
|
2015-06-20 16:10:54 +00:00
|
|
|
|
|
|
|
git checkout newbranch
|
|
|
|
git checkout master
|
|
|
|
rm -rf .git/lfs/objects
|
|
|
|
|
2015-07-29 15:34:15 +00:00
|
|
|
git lfs fetch master newbranch
|
|
|
|
assert_pointer "master" "a.dat" "$contents_oid" 1
|
|
|
|
assert_pointer "newbranch" "b.dat" "$b_oid" 1
|
|
|
|
|
2015-06-20 16:10:54 +00:00
|
|
|
)
|
|
|
|
end_test
|