| 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | . "$(dirname "$0")/testlib.sh" |
| 4 | |
| 5 | begin_test "mergetool works with large files" |
| 6 | ( |
| 7 | set -e |
| 8 | |
| 9 | reponame="mergetool-works-with-large-files" |
| 10 | git init "$reponame" |
| 11 | cd "$reponame" |
| 12 | |
| 13 | git lfs track "*.dat" |
| 14 | printf "base" > conflict.dat |
| 15 | git add .gitattributes conflict.dat |
| 16 | git commit -m "initial commit" |
| 17 | |
| 18 | git checkout -b conflict |
| 19 | printf "b" > conflict.dat |
| 20 | git add conflict.dat |
| 21 | git commit -m "conflict.dat: b" |
| 22 | |
| 23 | git checkout main |
| 24 | |
| 25 | printf "a" > conflict.dat |
| 26 | git add conflict.dat |
| 27 | git commit -m "conflict.dat: a" |
| 28 | |
| 29 | set +e |
| 30 | git merge conflict |
| 31 | set -e |
| 32 | |
| 33 | git config mergetool.inspect.cmd ' |
| 34 | for i in BASE LOCAL REMOTE; do |
| 35 | echo "\$$i=$(eval "cat \"\$$i\"")"; |
| 36 | done; |
| 37 | exit 1 |
| 38 | ' |
| 39 | git config mergetool.inspect.trustExitCode true |
| 40 | |
| 41 | yes | git mergetool \ |
| 42 | --no-prompt \ |
| 43 | --tool=inspect \ |
| 44 | -- conflict.dat 2>&1 \ |
| 45 | | tee mergetool.log |
| 46 | |
| 47 | grep "\$BASE=base" mergetool.log |
| 48 | grep "\$LOCAL=a" mergetool.log |
| 49 | grep "\$REMOTE=b" mergetool.log |
| 50 | ) |
| 51 | end_test |