n2a
n2a copied to clipboard
Git rebase during pull
Currently, the code sets the rebase flag when doing a pull. However, replaying commits using git's own machinery could produce incorrect results. It would be better to replay the commits using special knowledge of our data structure. This would only become an issue if the user creates commits while offline, since the system tries to prevent a branch from forming while online. That is, pulls will generally be fast-forward.
Instead of pull, the procedure would be:
save stash
fetch master
LCA = merge-base (HEAD, master)
local = HEAD # "local" is a temporary reference to remember HEAD
checkout master # HEAD moved to master
for LCA...local # This could be empty, in which case it is a fast-forward
replay commit using n2a diff, and using working tree to assemble
apply stash
dead branch can be garbage collected later