9e006ac4e2
Currently, our default branch in tests is "master". This is the Git default, but the Git default will likely change in the future, so it makes sense to update our testsuite to be explicit about the branch name. We'll ensure this continues by building against older versions of Git as well as newer versions. We use "main" for the new branch name, since that's the proposed value upstream. This commit was made entirely by automated means using the following command: git grep -l master t | xargs sed -i -e 's/master/main/g'
52 lines
1.5 KiB
Bash
Executable File
52 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
. "$(dirname "$0")/testlib.sh"
|
|
|
|
begin_test "commit, delete, then push"
|
|
(
|
|
set -e
|
|
|
|
reponame="$(basename "$0" ".sh")"
|
|
setup_remote_repo "$reponame"
|
|
clone_repo "$reponame" repo
|
|
|
|
git lfs track "*.dat"
|
|
|
|
deleted_oid=$(calc_oid "deleted\n")
|
|
echo "deleted" > deleted.dat
|
|
git add deleted.dat .gitattributes
|
|
git commit -m "add deleted file"
|
|
|
|
git lfs push origin main --dry-run | grep "push ee31ef227442936872744b50d3297385c08b40ffc7baeaf34a39e6d81d6cd9ee => deleted.dat"
|
|
|
|
assert_pointer "main" "deleted.dat" "$deleted_oid" 8
|
|
|
|
added_oid=$(calc_oid "added\n")
|
|
echo "added" > added.dat
|
|
git add added.dat
|
|
git commit -m "add file"
|
|
|
|
git lfs push origin main --dry-run | tee dryrun.log
|
|
grep "push ee31ef227442936872744b50d3297385c08b40ffc7baeaf34a39e6d81d6cd9ee => deleted.dat" dryrun.log
|
|
grep "push 3428719b7688c78a0cc8ba4b9e80b4e464c815fbccfd4b20695a15ffcefc22af => added.dat" dryrun.log
|
|
|
|
git rm deleted.dat
|
|
git commit -m "did not need deleted.dat after all"
|
|
|
|
git lfs push origin main --dry-run 2>&1 | tee dryrun.log
|
|
grep "push ee31ef227442936872744b50d3297385c08b40ffc7baeaf34a39e6d81d6cd9ee => deleted.dat" dryrun.log
|
|
grep "push 3428719b7688c78a0cc8ba4b9e80b4e464c815fbccfd4b20695a15ffcefc22af => added.dat" dryrun.log
|
|
|
|
git log
|
|
git push origin main 2>&1 > push.log || {
|
|
cat push.log
|
|
git lfs logs last
|
|
exit 1
|
|
}
|
|
grep "(2 of 2 files)" push.log | cat push.log
|
|
|
|
assert_server_object "$reponame" "$deleted_oid"
|
|
assert_server_object "$reponame" "$added_oid"
|
|
)
|
|
end_test
|