github.com/saracen/git-lfs@v2.5.2+incompatible/t/t-commit-delete-push.sh (about) 1 #!/usr/bin/env bash 2 3 . "$(dirname "$0")/testlib.sh" 4 5 begin_test "commit, delete, then push" 6 ( 7 set -e 8 9 reponame="$(basename "$0" ".sh")" 10 setup_remote_repo "$reponame" 11 clone_repo "$reponame" repo 12 13 git lfs track "*.dat" 14 15 deleted_oid=$(calc_oid "deleted\n") 16 echo "deleted" > deleted.dat 17 git add deleted.dat .gitattributes 18 git commit -m "add deleted file" 19 20 git lfs push origin master --dry-run | grep "push ee31ef227442936872744b50d3297385c08b40ffc7baeaf34a39e6d81d6cd9ee => deleted.dat" 21 22 assert_pointer "master" "deleted.dat" "$deleted_oid" 8 23 24 added_oid=$(calc_oid "added\n") 25 echo "added" > added.dat 26 git add added.dat 27 git commit -m "add file" 28 29 git lfs push origin master --dry-run | tee dryrun.log 30 grep "push ee31ef227442936872744b50d3297385c08b40ffc7baeaf34a39e6d81d6cd9ee => deleted.dat" dryrun.log 31 grep "push 3428719b7688c78a0cc8ba4b9e80b4e464c815fbccfd4b20695a15ffcefc22af => added.dat" dryrun.log 32 33 git rm deleted.dat 34 git commit -m "did not need deleted.dat after all" 35 36 git lfs push origin master --dry-run 2>&1 | tee dryrun.log 37 grep "push ee31ef227442936872744b50d3297385c08b40ffc7baeaf34a39e6d81d6cd9ee => deleted.dat" dryrun.log 38 grep "push 3428719b7688c78a0cc8ba4b9e80b4e464c815fbccfd4b20695a15ffcefc22af => added.dat" dryrun.log 39 40 git log 41 git push origin master 2>&1 > push.log || { 42 cat push.log 43 git lfs logs last 44 exit 1 45 } 46 grep "(2 of 2 files)" push.log | cat push.log 47 48 assert_server_object "$reponame" "$deleted_oid" 49 assert_server_object "$reponame" "$added_oid" 50 ) 51 end_test