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