shellcheck / shellcheck (push) Failing after 17s
An interrupted plugin update can leave a plugin's files out of step with its checkout, and lazy.nvim then refuses to update it, every time. Before syncing, update now stashes such changes, so they can still be recovered with git stash pop, and puts the plugin's submodules back. Flathub retired org.mozilla.Thunderbird in favor of org.mozilla.thunderbird_esr, so update tried to reinstall the old ID on every run. Install the new one. flatpak update already moves existing installs over; a migration carries a skip-packages entry for the old ID over to the new one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
56 lines
1.6 KiB
Bash
56 lines
1.6 KiB
Bash
#!/usr/bin/env bats
|
|
|
|
load test_helper
|
|
|
|
# updates.d/46-neovim.sh, with real git repositories standing in for the
|
|
# plugins lazy.nvim cloned
|
|
|
|
setup() {
|
|
common_setup
|
|
export XDG_DATA_HOME="$HOME/.local/share"
|
|
LAZY="$XDG_DATA_HOME/nvim/lazy"
|
|
mkdir -p "$LAZY"
|
|
export GIT_AUTHOR_NAME=test GIT_AUTHOR_EMAIL=test@example.com
|
|
export GIT_COMMITTER_NAME=test GIT_COMMITTER_EMAIL=test@example.com
|
|
stub nvim 'echo "nvim ran" >> "$BATS_TEST_TMPDIR/nvim.log"'
|
|
}
|
|
|
|
# plugin NAME: a plugin checkout with one committed file
|
|
plugin() {
|
|
git init -q "$LAZY/$1"
|
|
echo original > "$LAZY/$1/README.md"
|
|
git -C "$LAZY/$1" add README.md
|
|
git -C "$LAZY/$1" commit -q -m initial
|
|
}
|
|
|
|
update_neovim() {
|
|
source "$REPO/updates.d/46-neovim.sh"
|
|
run_update
|
|
}
|
|
|
|
@test "a plugin with local changes is stashed so lazy.nvim can update it" {
|
|
plugin LuaSnip
|
|
echo changed > "$LAZY/LuaSnip/README.md"
|
|
echo build output > "$LAZY/LuaSnip/untracked.so"
|
|
|
|
run update_neovim
|
|
[ "$status" -eq 0 ]
|
|
[[ "$output" == *"LuaSnip had local changes"* ]]
|
|
[ -z "$(git -C "$LAZY/LuaSnip" ls-files -d -m)" ]
|
|
[ "$(cat "$LAZY/LuaSnip/README.md")" = original ]
|
|
# The changes can be got back, and untracked build output is left alone
|
|
git -C "$LAZY/LuaSnip" stash list | grep -q "Stashed by CoreDesktop's update"
|
|
[ -f "$LAZY/LuaSnip/untracked.so" ]
|
|
grep -q "nvim ran" "$BATS_TEST_TMPDIR/nvim.log"
|
|
}
|
|
|
|
@test "plugins without local changes are left as they are" {
|
|
plugin lazy.nvim
|
|
echo build output > "$LAZY/lazy.nvim/untracked.so"
|
|
|
|
run update_neovim
|
|
[ "$status" -eq 0 ]
|
|
[[ "$output" != *"local changes"* ]]
|
|
[ -z "$(git -C "$LAZY/lazy.nvim" stash list)" ]
|
|
}
|