Skip to content

Add autostash handling to update-dotfiles#477

Open
shunk031 wants to merge 1 commit into
mainfrom
feat/update-dotfiles-autostash
Open

Add autostash handling to update-dotfiles#477
shunk031 wants to merge 1 commit into
mainfrom
feat/update-dotfiles-autostash

Conversation

@shunk031

Copy link
Copy Markdown
Owner

Summary

  • Autostash dirty public/private chezmoi source changes before fetching and applying updates.
  • Restore the autostash with git stash pop --index immediately after the update attempt so local work is not left hidden by default.
  • Cover the happy path and restore-failure path in the update-dotfiles bats tests.

Autostash Risk Notes

  • git stash pop --index can conflict after the source repository fast-forwards. When that happens, Git keeps the stash entry; the command now reports the restore failure and tells the operator to inspect the remaining stash.
  • This only handles dirty source repositories. Destination-side chezmoi conflicts, such as files changed since chezmoi last wrote them, are separate and still require interactive handling or explicit skip behavior.

Validation

  • bash -n home/dot_local/bin/exact_common/executable_update-dotfiles
  • shfmt -i 4 -sr -d home/dot_local/bin/exact_common/executable_update-dotfiles tests/install/common/update_dotfiles.bats
  • shellcheck home/dot_local/bin/exact_common/executable_update-dotfiles
  • Manual stub smoke test for dirty-source autostash call order

Note: I did not run bats locally per the repository test policy; GitHub Actions should validate the bats suite.

@codecov

codecov Bot commented Jun 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.18%. Comparing base (3125d17) to head (5d4b5c3).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #477      +/-   ##
==========================================
+ Coverage   90.19%   91.18%   +0.98%     
==========================================
  Files          10       10              
  Lines         306      329      +23     
==========================================
+ Hits          276      300      +24     
+ Misses         30       29       -1     
Flag Coverage Δ
macos-14-client 41.66% <ø> (ø)
ubuntu-latest-client 91.15% <100.00%> (+1.65%) ⬆️
ubuntu-latest-server 90.54% <100.00%> (+0.35%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant