Skyblocker
Skyblocker copied to clipboard
Also do shallow fetch for NEU repo
This is based on codes and talks in #1644. This PR makes the NEU manager use fetch --depth 1 to update the remote ref and then hard reset the local branch to it. Auto stash is also introduced to preserve the old feature of keeping local changes, like smart checkout in some IDEs.
pros:
- Extend shallow state to every commit. The repo will always have only 1 shallow commit after updates.
- Enhanced error resistantance (for remote force-push, etc.)
cons:
- More Git operations needed for updating repo.
- Logs in
.git/shallowwill grow and not be truncated (see https://github.com/SkyblockerMod/Skyblocker/pull/1644#issuecomment-3257660951) - The benefit of shallowing new commits may not be as obvious as cloning, because only a small number of commits are updated at a time, and the old contents are still stored compressed in
.git/objects/packas the requirement of incremental update.
So it's also ok if we ain't gonna merge this. 👌