Sync algorithm¶
You may have noticed that tsrc sync does not just calls git pull on every repository.
Here's the algorithm that is used:
- Run
git fetch --tags --prune - Check if the repository is on a branch
- Check if the currently checked out branch matches the one configured
in the manifest. If it does not, the repository is clean and the
--no-correct-branchflag is NOT set, the branch is changed to the configured one. - Check if the repository is dirty
- Try and run a fast-forward merge
Note that:
git fetchis always called so that local refs are up-to-datetsrcwill simply print an error and move on to the next repository if the fast-forward merge is not possible. That's becausetsrccannot guess what the correct action is, so it prefers doing nothing. It's up to the user to run something likegit mergeorgit rebase.- in case the repository is on an incorrect branch, the fast-forward merge will still be attempted, but an error message will be show in the end