| 1 | #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash |
| 2 | |
| 3 | . "$(dirnamescip-shell system . . dirname. "$0")/testlib.sh" |
| 4 | |
| 5 | reponame="$(basenamescip-shell system . . basename. "$0" ".sh")" |
| 6 | contents="big file" |
| 7 | contents_oid=$(calc_oid "$contents") |
| 8 | |
| 9 | begin_test "fetch: setup for include test" |
| 10 | ( |
| 11 | set -e |
| 12 | |
| 13 | setup_remote_repo "$reponame" |
| 14 | clone_repo "$reponame" repo |
| 15 | |
| 16 | gitscip-shell system . . git. lfs track "*.big" |
| 17 | mkdirscip-shell system . . mkdir. -p big/a |
| 18 | mkdirscip-shell system . . mkdir. -p big/b |
| 19 | |
| 20 | printfscip-shell system . . printf. "%s" "$contents" > big/a/a1.big |
| 21 | printfscip-shell system . . printf. "%s" "$contents" > big/b/b1.big |
| 22 | |
| 23 | contents2="big file 2" |
| 24 | printfscip-shell system . . printf. "%s" "$contents2" > big/big1.big |
| 25 | printfscip-shell system . . printf. "%s" "$contents2" > big/big2.big |
| 26 | printfscip-shell system . . printf. "%s" "$contents2" > big/big3.big |
| 27 | |
| 28 | gitscip-shell system . . git. add .gitattributes big |
| 29 | gitscip-shell system . . git. commit -m "commit" | teescip-shell system . . tee. commit.log |
| 30 | grepscip-shell system . . grep. "6 files changed" commit.log |
| 31 | grepscip-shell system . . grep. "create mode 100644 .gitattributes" commit.log |
| 32 | grepscip-shell system . . grep. "create mode 100644 big/a/a1.big" commit.log |
| 33 | grepscip-shell system . . grep. "create mode 100644 big/b/b1.big" commit.log |
| 34 | grepscip-shell system . . grep. "create mode 100644 big/big1.big" commit.log |
| 35 | grepscip-shell system . . grep. "create mode 100644 big/big2.big" commit.log |
| 36 | grepscip-shell system . . grep. "create mode 100644 big/big3.big" commit.log |
| 37 | |
| 38 | gitscip-shell system . . git. push origin main | teescip-shell system . . tee. push.log |
| 39 | grepscip-shell system . . grep. "Uploading LFS objects: 100% (2/2), 18 B" push.log |
| 40 | |
| 41 | assert_server_object "$reponame" "$contents_oid" |
| 42 | ) |
| 43 | end_test |
| 44 | |
| 45 | begin_test "fetch: include first matching file" |
| 46 | ( |
| 47 | set -e |
| 48 | |
| 49 | mkdirscip-shell system . . mkdir. clone-1 |
| 50 | cd clone-1 |
| 51 | gitscip-shell system . . git. init |
| 52 | gitscip-shell system . . git. lfs install --local --skip-smudge |
| 53 | gitscip-shell system . . git. remote add origin $GITSERVER/$reponame |
| 54 | gitscip-shell system . . git. pull origin main |
| 55 | |
| 56 | refute_local_object "$contents_oid" |
| 57 | |
| 58 | gitscip-shell system . . git. lfs ls-files |
| 59 | |
| 60 | gitscip-shell system . . git. lfs fetch --include=big/a |
| 61 | |
| 62 | assert_local_object "$contents_oid" "8" |
| 63 | ) |
| 64 | end_test |
| 65 | |
| 66 | begin_test "fetch: include second matching file" |
| 67 | ( |
| 68 | set -e |
| 69 | |
| 70 | mkdirscip-shell system . . mkdir. clone-2 |
| 71 | cd clone-2 |
| 72 | gitscip-shell system . . git. init |
| 73 | gitscip-shell system . . git. lfs install --local --skip-smudge |
| 74 | gitscip-shell system . . git. remote add origin $GITSERVER/$reponame |
| 75 | gitscip-shell system . . git. pull origin main |
| 76 | |
| 77 | refute_local_object "$contents_oid" |
| 78 | |
| 79 | gitscip-shell system . . git. lfs ls-files |
| 80 | |
| 81 | gitscip-shell system . . git. lfs fetch --include=big/b |
| 82 | |
| 83 | assert_local_object "$contents_oid" "8" |
| 84 | ) |
| 85 | end_test |