fix: explicitly fetch base branch before rebase in sync #37
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes an issue where
stack syncwouldn't update branches to the latest base branch (e.g.,master) in certain configurations.Problem:
When rebasing onto a base branch like
origin/master, the sync relied on the generalgit fetch originto update the tracking ref. However, in repos with limited refspecs or certain git configurations, this fetch may not reliably updateorigin/master.Solution:
Explicitly fetch the base branch using
FetchBranch()right before rebasing onto it. This ensures the tracking ref is always up-to-date before the rebase.The fetch is non-fatal, so if it fails (e.g., network issues), the sync continues with the existing ref.