#!/bin/bash # shellcheck disable=SC2034 DESCRIPTION="local edits to the checkout: kept if upstream doesn't touch the file, reported if it does" IMAGE=installed TIER="pr" # Expanded in the VM, not here # shellcheck disable=SC2088 CD="~/.local/share/coredesktop" scenario() { assert_vm "edit README.md in the checkout" "echo '# local edit' >> $CD/README.md" upstream_commit "Change packages.conf" 'echo "# upstream change" >> packages.conf' cd_update assert_status 0 assert_vm "the edit is kept" "tail -n 1 $CD/README.md | grep -qx '# local edit'" assert_vm "the upstream change arrived" "tail -n 1 $CD/packages.conf | grep -qx '# upstream change'" upstream_commit "Change README.md" 'echo "# upstream readme change" >> README.md' cd_update assert_status 1 assert_output "Done, with errors in: git pull" assert_vm "throw the edit away" "git -C $CD checkout -- README.md" cd_update assert_status 0 }