2015-07-30 02:37:31 +00:00
|
|
|
#!/usr/bin/env bash
|
2015-05-26 21:09:24 +00:00
|
|
|
|
|
|
|
. "test/testlib.sh"
|
|
|
|
|
|
|
|
begin_test "push"
|
|
|
|
(
|
|
|
|
set -e
|
|
|
|
|
|
|
|
reponame="$(basename "$0" ".sh")"
|
|
|
|
setup_remote_repo "$reponame"
|
|
|
|
clone_repo "$reponame" repo
|
|
|
|
|
|
|
|
git lfs track "*.dat"
|
|
|
|
echo "push a" > a.dat
|
|
|
|
git add .gitattributes a.dat
|
|
|
|
git commit -m "add a.dat"
|
|
|
|
|
2015-09-09 20:18:51 +00:00
|
|
|
git lfs push --dry-run origin master 2>&1 | tee push.log
|
|
|
|
grep "push 4c48d2a6991c9895bcddcf027e1e4907280bcf21975492b1afbade396d6a3340 => a.dat" push.log
|
2015-09-09 22:09:56 +00:00
|
|
|
[ $(grep -c "push" push.log) -eq 1 ]
|
2015-09-09 20:18:51 +00:00
|
|
|
|
2015-05-27 20:18:02 +00:00
|
|
|
git lfs push origin master 2>&1 | tee push.log
|
|
|
|
grep "(1 of 1 files)" push.log
|
2015-05-26 21:09:24 +00:00
|
|
|
|
|
|
|
git checkout -b push-b
|
|
|
|
echo "push b" > b.dat
|
|
|
|
git add b.dat
|
|
|
|
git commit -m "add b.dat"
|
|
|
|
|
2015-09-09 20:18:51 +00:00
|
|
|
git lfs push --dry-run origin push-b 2>&1 | tee push.log
|
|
|
|
grep "push 4c48d2a6991c9895bcddcf027e1e4907280bcf21975492b1afbade396d6a3340 => a.dat" push.log
|
|
|
|
grep "push 82be50ad35070a4ef3467a0a650c52d5b637035e7ad02c36652e59d01ba282b7 => b.dat" push.log
|
2015-09-09 22:09:56 +00:00
|
|
|
[ $(grep -c "push" < push.log) -eq 2 ]
|
2015-09-09 20:18:51 +00:00
|
|
|
|
2015-09-09 20:58:58 +00:00
|
|
|
# simulate remote ref
|
|
|
|
mkdir -p .git/refs/remotes/origin
|
|
|
|
git rev-parse HEAD > .git/refs/remotes/origin/HEAD
|
|
|
|
|
|
|
|
git lfs push --dry-run origin push-b 2>&1 | tee push.log
|
2015-09-09 22:09:56 +00:00
|
|
|
[ $(grep -c "push" push.log) -eq 0 ]
|
2015-09-09 20:58:58 +00:00
|
|
|
|
|
|
|
rm -rf .git/refs/remotes
|
|
|
|
|
2015-05-27 20:18:02 +00:00
|
|
|
git lfs push origin push-b 2>&1 | tee push.log
|
2016-06-08 10:07:32 +00:00
|
|
|
grep "(1 of 1 files, 1 skipped)" push.log
|
2015-05-26 21:09:24 +00:00
|
|
|
)
|
|
|
|
end_test
|
|
|
|
|
2015-09-09 20:18:51 +00:00
|
|
|
# sets up the tests for the next few push --all tests
|
|
|
|
push_all_setup() {
|
2015-09-09 20:58:58 +00:00
|
|
|
suffix="$1"
|
2015-09-09 20:18:51 +00:00
|
|
|
reponame="$(basename "$0" ".sh")-all"
|
|
|
|
content1="initial"
|
|
|
|
content2="update"
|
|
|
|
content3="branch"
|
|
|
|
content4="tagged"
|
|
|
|
content5="master"
|
|
|
|
extracontent="extra"
|
2015-09-21 17:50:22 +00:00
|
|
|
oid1=$(calc_oid "$content1")
|
|
|
|
oid2=$(calc_oid "$content2")
|
|
|
|
oid3=$(calc_oid "$content3")
|
|
|
|
oid4=$(calc_oid "$content4")
|
|
|
|
oid5=$(calc_oid "$content5")
|
|
|
|
extraoid=$(calc_oid "$extracontent")
|
2015-09-09 20:18:51 +00:00
|
|
|
|
2015-09-09 20:58:58 +00:00
|
|
|
# if the local repo exists, it has already been bootstrapped
|
|
|
|
[ -d "push-all" ] && exit 0
|
|
|
|
|
|
|
|
clone_repo "$reponame" "push-all"
|
|
|
|
git lfs track "*.dat"
|
|
|
|
|
2015-09-09 20:18:51 +00:00
|
|
|
echo "[
|
|
|
|
{
|
|
|
|
\"CommitDate\":\"$(get_date -6m)\",
|
|
|
|
\"Files\":[
|
|
|
|
{\"Filename\":\"file1.dat\",\"Size\":${#content1},\"Data\":\"$content1\"}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
\"CommitDate\":\"$(get_date -5m)\",
|
|
|
|
\"Files\":[
|
|
|
|
{\"Filename\":\"file1.dat\",\"Size\":${#content2},\"Data\":\"$content2\"}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
\"CommitDate\":\"$(get_date -4m)\",
|
|
|
|
\"NewBranch\":\"branch\",
|
|
|
|
\"Files\":[
|
|
|
|
{\"Filename\":\"file1.dat\",\"Size\":${#content3},\"Data\":\"$content3\"}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
\"CommitDate\":\"$(get_date -4m)\",
|
|
|
|
\"ParentBranches\":[\"master\"],
|
|
|
|
\"Tags\":[\"tag\"],
|
|
|
|
\"Files\":[
|
|
|
|
{\"Filename\":\"file1.dat\",\"Size\":${#content4},\"Data\":\"$content4\"}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
\"CommitDate\":\"$(get_date -2m)\",
|
|
|
|
\"Files\":[
|
|
|
|
{\"Filename\":\"file1.dat\",\"Size\":${#content5},\"Data\":\"$content5\"},
|
|
|
|
{\"Filename\":\"file2.dat\",\"Size\":${#extracontent},\"Data\":\"$extracontent\"}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]" | lfstest-testutils addcommits
|
|
|
|
|
|
|
|
git rm file2.dat
|
|
|
|
git commit -m "remove file2.dat"
|
|
|
|
|
2015-09-09 20:58:58 +00:00
|
|
|
# simulate remote ref
|
|
|
|
mkdir -p .git/refs/remotes/origin
|
|
|
|
git rev-parse HEAD > .git/refs/remotes/origin/HEAD
|
|
|
|
|
2015-09-09 20:18:51 +00:00
|
|
|
setup_alternate_remote "$reponame-$suffix"
|
|
|
|
}
|
|
|
|
|
|
|
|
begin_test "push --all (no ref args)"
|
|
|
|
(
|
|
|
|
set -e
|
|
|
|
|
|
|
|
push_all_setup "everything"
|
|
|
|
|
|
|
|
git lfs push --dry-run --all origin 2>&1 | tee push.log
|
|
|
|
grep "push $oid1 => file1.dat" push.log
|
|
|
|
grep "push $oid2 => file1.dat" push.log
|
|
|
|
grep "push $oid3 => file1.dat" push.log
|
|
|
|
grep "push $oid4 => file1.dat" push.log
|
|
|
|
grep "push $oid5 => file1.dat" push.log
|
|
|
|
grep "push $extraoid => file2.dat" push.log
|
2015-09-09 22:09:56 +00:00
|
|
|
[ $(grep -c "push" < push.log) -eq 6 ]
|
2015-09-09 20:18:51 +00:00
|
|
|
|
|
|
|
git push --all origin 2>&1 | tee push.log
|
2016-04-06 19:06:34 +00:00
|
|
|
[ $(grep -c "(3 of 3 files)" push.log) -eq 2 ]
|
2015-09-09 20:58:58 +00:00
|
|
|
assert_server_object "$reponame-$suffix" "$oid1"
|
|
|
|
assert_server_object "$reponame-$suffix" "$oid2"
|
|
|
|
assert_server_object "$reponame-$suffix" "$oid3"
|
|
|
|
assert_server_object "$reponame-$suffix" "$oid4"
|
|
|
|
assert_server_object "$reponame-$suffix" "$oid5"
|
|
|
|
assert_server_object "$reponame-$suffix" "$extraoid"
|
|
|
|
|
|
|
|
echo "push while missing old objects locally"
|
|
|
|
setup_alternate_remote "$reponame-$suffix-2"
|
|
|
|
git lfs push --object-id origin $oid1
|
|
|
|
assert_server_object "$reponame-$suffix-2" "$oid1"
|
|
|
|
refute_server_object "$reponame-$suffix-2" "$oid2"
|
|
|
|
refute_server_object "$reponame-$suffix-2" "$oid3"
|
|
|
|
refute_server_object "$reponame-$suffix-2" "$oid4"
|
|
|
|
refute_server_object "$reponame-$suffix-2" "$oid5"
|
|
|
|
refute_server_object "$reponame-$suffix-2" "$extraoid"
|
|
|
|
rm ".git/lfs/objects/${oid1:0:2}/${oid1:2:2}/$oid1"
|
|
|
|
|
2016-04-06 19:06:34 +00:00
|
|
|
echo "dry run missing local object that exists on server"
|
2015-09-09 20:58:58 +00:00
|
|
|
git lfs push --dry-run --all origin 2>&1 | tee push.log
|
|
|
|
grep "push $oid1 => file1.dat" push.log
|
|
|
|
grep "push $oid2 => file1.dat" push.log
|
|
|
|
grep "push $oid3 => file1.dat" push.log
|
|
|
|
grep "push $oid4 => file1.dat" push.log
|
|
|
|
grep "push $oid5 => file1.dat" push.log
|
|
|
|
grep "push $extraoid => file2.dat" push.log
|
|
|
|
[ $(grep -c "push" push.log) -eq 6 ]
|
|
|
|
|
|
|
|
git push --all origin 2>&1 | tee push.log
|
2016-06-08 10:07:32 +00:00
|
|
|
grep "(2 of 2 files, 1 skipped)" push.log
|
2016-04-06 19:06:34 +00:00
|
|
|
grep "(3 of 3 files)" push.log
|
2016-04-07 17:28:51 +00:00
|
|
|
[ $(grep -c "files)" push.log) -eq 1 ]
|
|
|
|
[ $(grep -c "skipped)" push.log) -eq 1 ]
|
2015-09-09 20:58:58 +00:00
|
|
|
assert_server_object "$reponame-$suffix-2" "$oid2"
|
|
|
|
assert_server_object "$reponame-$suffix-2" "$oid3"
|
|
|
|
assert_server_object "$reponame-$suffix-2" "$oid4"
|
|
|
|
assert_server_object "$reponame-$suffix-2" "$oid5"
|
|
|
|
assert_server_object "$reponame-$suffix-2" "$extraoid"
|
2015-09-09 20:18:51 +00:00
|
|
|
)
|
|
|
|
end_test
|
|
|
|
|
|
|
|
begin_test "push --all (1 ref arg)"
|
|
|
|
(
|
|
|
|
set -e
|
|
|
|
|
|
|
|
push_all_setup "ref"
|
|
|
|
|
|
|
|
git lfs push --dry-run --all origin branch 2>&1 | tee push.log
|
|
|
|
grep "push $oid1 => file1.dat" push.log
|
|
|
|
grep "push $oid2 => file1.dat" push.log
|
|
|
|
grep "push $oid3 => file1.dat" push.log
|
2015-09-09 22:09:56 +00:00
|
|
|
[ $(grep -c "push" < push.log) -eq 3 ]
|
2015-09-09 20:18:51 +00:00
|
|
|
|
|
|
|
git lfs push --all origin branch 2>&1 | tee push.log
|
|
|
|
grep "3 files" push.log
|
2015-09-09 20:58:58 +00:00
|
|
|
assert_server_object "$reponame-$suffix" "$oid1"
|
|
|
|
assert_server_object "$reponame-$suffix" "$oid2"
|
|
|
|
assert_server_object "$reponame-$suffix" "$oid3"
|
|
|
|
refute_server_object "$reponame-$suffix" "$oid4" # in master and the tag
|
|
|
|
refute_server_object "$reponame-$suffix" "$oid5"
|
|
|
|
refute_server_object "$reponame-$suffix" "$extraoid"
|
|
|
|
|
|
|
|
echo "push while missing old objects locally"
|
|
|
|
setup_alternate_remote "$reponame-$suffix-2"
|
|
|
|
git lfs push --object-id origin $oid1
|
|
|
|
assert_server_object "$reponame-$suffix-2" "$oid1"
|
|
|
|
refute_server_object "$reponame-$suffix-2" "$oid2"
|
|
|
|
refute_server_object "$reponame-$suffix-2" "$oid3"
|
|
|
|
refute_server_object "$reponame-$suffix-2" "$oid4"
|
|
|
|
refute_server_object "$reponame-$suffix-2" "$oid5"
|
|
|
|
refute_server_object "$reponame-$suffix-2" "$extraoid"
|
|
|
|
rm ".git/lfs/objects/${oid1:0:2}/${oid1:2:2}/$oid1"
|
|
|
|
|
|
|
|
# dry run doesn't change
|
|
|
|
git lfs push --dry-run --all origin branch 2>&1 | tee push.log
|
|
|
|
grep "push $oid1 => file1.dat" push.log
|
|
|
|
grep "push $oid2 => file1.dat" push.log
|
|
|
|
grep "push $oid3 => file1.dat" push.log
|
|
|
|
[ $(grep -c "push" push.log) -eq 3 ]
|
|
|
|
|
|
|
|
git push --all origin branch 2>&1 | tee push.log
|
|
|
|
grep "5 files, 1 skipped" push.log # should be 5?
|
|
|
|
assert_server_object "$reponame-$suffix-2" "$oid2"
|
|
|
|
assert_server_object "$reponame-$suffix-2" "$oid3"
|
|
|
|
refute_server_object "$reponame-$suffix-2" "$oid4"
|
|
|
|
refute_server_object "$reponame-$suffix-2" "$oid5"
|
|
|
|
refute_server_object "$reponame-$suffix-2" "$extraoid"
|
2015-09-09 20:18:51 +00:00
|
|
|
)
|
|
|
|
end_test
|
|
|
|
|
|
|
|
begin_test "push --all (multiple ref args)"
|
|
|
|
(
|
|
|
|
set -e
|
|
|
|
|
|
|
|
push_all_setup "multiple-refs"
|
|
|
|
|
|
|
|
git lfs push --dry-run --all origin branch tag 2>&1 | tee push.log
|
|
|
|
grep "push $oid1 => file1.dat" push.log
|
|
|
|
grep "push $oid2 => file1.dat" push.log
|
|
|
|
grep "push $oid3 => file1.dat" push.log
|
|
|
|
grep "push $oid4 => file1.dat" push.log
|
2015-09-09 22:09:56 +00:00
|
|
|
[ $(grep -c "push" push.log) -eq 4 ]
|
2015-09-09 20:18:51 +00:00
|
|
|
|
|
|
|
git lfs push --all origin branch tag 2>&1 | tee push.log
|
|
|
|
grep "4 files" push.log
|
2015-09-09 20:58:58 +00:00
|
|
|
assert_server_object "$reponame-$suffix" "$oid1"
|
|
|
|
assert_server_object "$reponame-$suffix" "$oid2"
|
|
|
|
assert_server_object "$reponame-$suffix" "$oid3"
|
|
|
|
assert_server_object "$reponame-$suffix" "$oid4"
|
|
|
|
refute_server_object "$reponame-$suffix" "$oid5" # only in master
|
|
|
|
refute_server_object "$reponame-$suffix" "$extraoid"
|
|
|
|
|
|
|
|
echo "push while missing old objects locally"
|
|
|
|
setup_alternate_remote "$reponame-$suffix-2"
|
|
|
|
git lfs push --object-id origin $oid1
|
|
|
|
assert_server_object "$reponame-$suffix-2" "$oid1"
|
|
|
|
refute_server_object "$reponame-$suffix-2" "$oid2"
|
|
|
|
refute_server_object "$reponame-$suffix-2" "$oid3"
|
|
|
|
refute_server_object "$reponame-$suffix-2" "$oid4"
|
|
|
|
refute_server_object "$reponame-$suffix-2" "$oid5"
|
|
|
|
refute_server_object "$reponame-$suffix-2" "$extraoid"
|
|
|
|
rm ".git/lfs/objects/${oid1:0:2}/${oid1:2:2}/$oid1"
|
|
|
|
|
|
|
|
# dry run doesn't change
|
|
|
|
git lfs push --dry-run --all origin branch tag 2>&1 | tee push.log
|
|
|
|
grep "push $oid1 => file1.dat" push.log
|
|
|
|
grep "push $oid2 => file1.dat" push.log
|
|
|
|
grep "push $oid3 => file1.dat" push.log
|
|
|
|
grep "push $oid4 => file1.dat" push.log
|
|
|
|
[ $(grep -c "push" push.log) -eq 3 ]
|
|
|
|
|
|
|
|
git push --all origin branch tag 2>&1 | tee push.log
|
|
|
|
grep "5 files, 1 skipped" push.log # should be 5?
|
|
|
|
assert_server_object "$reponame-$suffix-2" "$oid2"
|
|
|
|
assert_server_object "$reponame-$suffix-2" "$oid3"
|
|
|
|
assert_server_object "$reponame-$suffix-2" "$oid4"
|
|
|
|
refute_server_object "$reponame-$suffix-2" "$oid5"
|
|
|
|
refute_server_object "$reponame-$suffix-2" "$extraoid"
|
2015-09-09 20:18:51 +00:00
|
|
|
)
|
|
|
|
end_test
|
|
|
|
|
|
|
|
begin_test "push --all (ref with deleted files)"
|
|
|
|
(
|
|
|
|
set -e
|
|
|
|
|
|
|
|
push_all_setup "ref-with-deleted"
|
|
|
|
|
|
|
|
git lfs push --dry-run --all origin master 2>&1 | tee push.log
|
|
|
|
grep "push $oid1 => file1.dat" push.log
|
|
|
|
grep "push $oid2 => file1.dat" push.log
|
|
|
|
grep "push $oid4 => file1.dat" push.log
|
|
|
|
grep "push $oid5 => file1.dat" push.log
|
|
|
|
grep "push $extraoid => file2.dat" push.log
|
2015-09-09 22:09:56 +00:00
|
|
|
[ $(grep -c "push" push.log) -eq 5 ]
|
2015-09-09 20:18:51 +00:00
|
|
|
|
|
|
|
git lfs push --all origin master 2>&1 | tee push.log
|
|
|
|
grep "5 files" push.log
|
2015-09-09 20:58:58 +00:00
|
|
|
assert_server_object "$reponame-$suffix" "$oid1"
|
|
|
|
assert_server_object "$reponame-$suffix" "$oid2"
|
|
|
|
refute_server_object "$reponame-$suffix" "$oid3" # only in the branch
|
|
|
|
assert_server_object "$reponame-$suffix" "$oid4"
|
|
|
|
assert_server_object "$reponame-$suffix" "$oid5"
|
|
|
|
assert_server_object "$reponame-$suffix" "$extraoid"
|
|
|
|
|
|
|
|
echo "push while missing old objects locally"
|
|
|
|
setup_alternate_remote "$reponame-$suffix-2"
|
|
|
|
git lfs push --object-id origin $oid1
|
|
|
|
assert_server_object "$reponame-$suffix-2" "$oid1"
|
|
|
|
refute_server_object "$reponame-$suffix-2" "$oid2"
|
|
|
|
refute_server_object "$reponame-$suffix-2" "$oid3"
|
|
|
|
refute_server_object "$reponame-$suffix-2" "$oid4"
|
|
|
|
refute_server_object "$reponame-$suffix-2" "$oid5"
|
|
|
|
refute_server_object "$reponame-$suffix-2" "$extraoid"
|
|
|
|
rm ".git/lfs/objects/${oid1:0:2}/${oid1:2:2}/$oid1"
|
|
|
|
|
|
|
|
# dry run doesn't change
|
|
|
|
git lfs push --dry-run --all origin master 2>&1 | tee push.log
|
|
|
|
grep "push $oid1 => file1.dat" push.log
|
|
|
|
grep "push $oid2 => file1.dat" push.log
|
|
|
|
grep "push $oid4 => file1.dat" push.log
|
|
|
|
grep "push $oid5 => file1.dat" push.log
|
|
|
|
grep "push $extraoid => file2.dat" push.log
|
|
|
|
[ $(grep -c "push" push.log) -eq 5 ]
|
|
|
|
|
|
|
|
git push --all origin master 2>&1 | tee push.log
|
|
|
|
grep "5 files, 1 skipped" push.log # should be 5?
|
|
|
|
assert_server_object "$reponame-$suffix-2" "$oid2"
|
|
|
|
refute_server_object "$reponame-$suffix-2" "$oid3"
|
|
|
|
assert_server_object "$reponame-$suffix-2" "$oid4"
|
|
|
|
assert_server_object "$reponame-$suffix-2" "$oid5"
|
|
|
|
assert_server_object "$reponame-$suffix-2" "$extraoid"
|
2015-05-26 21:09:24 +00:00
|
|
|
)
|
|
|
|
end_test
|
2015-06-28 15:13:44 +00:00
|
|
|
|
|
|
|
begin_test "push object id(s)"
|
|
|
|
(
|
|
|
|
set -e
|
|
|
|
|
|
|
|
reponame="$(basename "$0" ".sh")"
|
|
|
|
setup_remote_repo "$reponame"
|
|
|
|
clone_repo "$reponame" repo2
|
|
|
|
|
|
|
|
git lfs track "*.dat"
|
|
|
|
echo "push a" > a.dat
|
|
|
|
git add .gitattributes a.dat
|
|
|
|
git commit -m "add a.dat"
|
|
|
|
|
2015-07-06 09:34:49 +00:00
|
|
|
git lfs push --object-id origin \
|
2015-06-28 15:13:44 +00:00
|
|
|
4c48d2a6991c9895bcddcf027e1e4907280bcf21975492b1afbade396d6a3340 \
|
|
|
|
2>&1 | tee push.log
|
2016-06-08 10:07:32 +00:00
|
|
|
grep "(0 of 0 files, 1 skipped)" push.log
|
2015-06-28 15:13:44 +00:00
|
|
|
|
|
|
|
echo "push b" > b.dat
|
|
|
|
git add b.dat
|
|
|
|
git commit -m "add b.dat"
|
|
|
|
|
2015-07-06 09:34:49 +00:00
|
|
|
git lfs push --object-id origin \
|
2015-06-28 15:13:44 +00:00
|
|
|
4c48d2a6991c9895bcddcf027e1e4907280bcf21975492b1afbade396d6a3340 \
|
|
|
|
82be50ad35070a4ef3467a0a650c52d5b637035e7ad02c36652e59d01ba282b7 \
|
|
|
|
2>&1 | tee push.log
|
2016-06-08 10:07:32 +00:00
|
|
|
grep "(0 of 0 files, 2 skipped)" push.log
|
2015-06-28 15:13:44 +00:00
|
|
|
)
|
|
|
|
end_test
|
2015-08-25 16:39:33 +00:00
|
|
|
|
|
|
|
begin_test "push modified files"
|
|
|
|
(
|
|
|
|
set -e
|
|
|
|
|
|
|
|
reponame="$(basename "$0" ".sh")-modified"
|
|
|
|
setup_remote_repo "$reponame"
|
|
|
|
clone_repo "$reponame" "$reponame"
|
|
|
|
|
|
|
|
git lfs track "*.dat"
|
|
|
|
# generate content we'll use
|
|
|
|
content1="filecontent1"
|
|
|
|
content2="filecontent2"
|
|
|
|
content3="filecontent3"
|
2015-08-26 10:29:57 +00:00
|
|
|
content4="filecontent4"
|
|
|
|
content5="filecontent5"
|
2015-09-21 17:50:22 +00:00
|
|
|
oid1=$(calc_oid "$content1")
|
|
|
|
oid2=$(calc_oid "$content2")
|
|
|
|
oid3=$(calc_oid "$content3")
|
|
|
|
oid4=$(calc_oid "$content4")
|
|
|
|
oid5=$(calc_oid "$content5")
|
2015-09-01 20:31:51 +00:00
|
|
|
|
2015-08-25 16:39:33 +00:00
|
|
|
echo "[
|
|
|
|
{
|
|
|
|
\"CommitDate\":\"$(get_date -6m)\",
|
|
|
|
\"Files\":[
|
|
|
|
{\"Filename\":\"file1.dat\",\"Size\":${#content1}, \"Data\":\"$content1\"}]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
\"CommitDate\":\"$(get_date -3m)\",
|
|
|
|
\"Files\":[
|
|
|
|
{\"Filename\":\"file1.dat\",\"Size\":${#content2}, \"Data\":\"$content2\"}]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
\"CommitDate\":\"$(get_date -1m)\",
|
2015-08-26 10:29:57 +00:00
|
|
|
\"NewBranch\":\"other_branch\",
|
|
|
|
\"Files\":[
|
|
|
|
{\"Filename\":\"file1.dat\",\"Size\":${#content5}, \"Data\":\"$content5\"}]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
\"CommitDate\":\"$(get_date -1m)\",
|
|
|
|
\"ParentBranches\":[\"master\"],
|
2015-08-25 16:39:33 +00:00
|
|
|
\"Files\":[
|
|
|
|
{\"Filename\":\"file1.dat\",\"Size\":${#content3}, \"Data\":\"$content3\"},
|
|
|
|
{\"Filename\":\"file2.dat\",\"Size\":${#content4}, \"Data\":\"$content4\"}]
|
|
|
|
}
|
|
|
|
]" | lfstest-testutils addcommits
|
|
|
|
|
2015-08-26 10:29:57 +00:00
|
|
|
git lfs push origin master
|
|
|
|
git lfs push origin other_branch
|
2015-08-25 16:39:33 +00:00
|
|
|
assert_server_object "$reponame" "$oid1"
|
|
|
|
assert_server_object "$reponame" "$oid2"
|
|
|
|
assert_server_object "$reponame" "$oid3"
|
|
|
|
assert_server_object "$reponame" "$oid4"
|
2015-08-26 10:29:57 +00:00
|
|
|
assert_server_object "$reponame" "$oid5"
|
2015-08-25 16:39:33 +00:00
|
|
|
)
|
|
|
|
end_test
|
2016-02-03 20:06:05 +00:00
|
|
|
|
|
|
|
begin_test "push with invalid remote"
|
|
|
|
(
|
|
|
|
set -e
|
|
|
|
cd repo
|
|
|
|
git lfs push not-a-remote 2>&1 | tee push.log
|
|
|
|
grep "Invalid remote name" push.log
|
|
|
|
)
|
|
|
|
end_test
|
2016-03-31 15:38:55 +00:00
|
|
|
|
|
|
|
begin_test "push ambiguous branch name"
|
|
|
|
(
|
|
|
|
set -e
|
|
|
|
|
|
|
|
reponame="$(basename "$0" ".sh")-ambiguous-branch"
|
|
|
|
setup_remote_repo "$reponame"
|
|
|
|
clone_repo "$reponame" "$reponame"
|
|
|
|
|
|
|
|
|
|
|
|
git lfs track "*.dat" 2>&1 | tee track.log
|
|
|
|
grep "Tracking \*.dat" track.log
|
|
|
|
|
|
|
|
NUMFILES=5
|
|
|
|
# generate content we'll use
|
|
|
|
for ((a=0; a < NUMFILES ; a++))
|
|
|
|
do
|
|
|
|
content[$a]="filecontent$a"
|
|
|
|
oid[$a]=$(calc_oid "${content[$a]}")
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "[
|
|
|
|
{
|
|
|
|
\"CommitDate\":\"$(get_date -10d)\",
|
|
|
|
\"Files\":[
|
|
|
|
{\"Filename\":\"file1.dat\",\"Size\":${#content[0]}, \"Data\":\"${content[0]}\"},
|
|
|
|
{\"Filename\":\"file2.dat\",\"Size\":${#content[1]}, \"Data\":\"${content[1]}\"}]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
\"NewBranch\":\"ambiguous\",
|
|
|
|
\"CommitDate\":\"$(get_date -5d)\",
|
|
|
|
\"Files\":[
|
|
|
|
{\"Filename\":\"file3.dat\",\"Size\":${#content[2]}, \"Data\":\"${content[2]}\"}]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
\"CommitDate\":\"$(get_date -2d)\",
|
|
|
|
\"Files\":[
|
|
|
|
{\"Filename\":\"file4.dat\",\"Size\":${#content[3]}, \"Data\":\"${content[3]}\"}]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
\"ParentBranches\":[\"master\"],
|
|
|
|
\"CommitDate\":\"$(get_date -1d)\",
|
|
|
|
\"Files\":[
|
|
|
|
{\"Filename\":\"file1.dat\",\"Size\":${#content[4]}, \"Data\":\"${content[4]}\"}]
|
|
|
|
}
|
|
|
|
]" | lfstest-testutils addcommits
|
|
|
|
|
|
|
|
# create tag with same name as branch
|
|
|
|
git tag ambiguous
|
|
|
|
|
|
|
|
# lfs push master, should work
|
|
|
|
git lfs push origin master
|
|
|
|
|
|
|
|
# push ambiguous, should fail
|
|
|
|
set +e
|
|
|
|
git lfs push origin ambiguous
|
|
|
|
if [ $? -eq 0 ]
|
|
|
|
then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
set -e
|
|
|
|
|
|
|
|
)
|
|
|
|
end_test
|