You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note that our use case is to publish a subdirectory of a monorepo
to a public subrepo. We only ever push, as there are never any
other changes to the remote subrepo. That push is automated as
part of the build and can cross with other developer commits.
Start the subrepo branch from the most recent subrepo.commit value
instead of from the subrepo.commit value that was current at the
time of the first commit to be included in the branch.
A simplified example of the situation:
Parent repo log
A -> B -> C -> D -> E -> F -> G
F: commit of .gitrepo file (subrepo.parent=D, subrepo.commit=C')
E: commit in subrepo directory
D: some commit
C: commit in subrepo directory
B: commit of .gitrepo file (subrepo.parent=A, subrepo.commit=A')
A: commit in subrepo directory
[Whilst pushing C to remote, D and E were committed to parent,
then the result of the push was committed to parent in F]
Remote repo log
A' -> C'
C': commit corresponding to C
A': commit corresponding to A
Now we want to push E to remote:
Before this change:
The rev-list used in subrepo:branch starts from D and gives [E, F].
commit E has .gitrepo file (subrepo.parent=A, subrepo.commit=A')
so the subrepo branch process starts from A', and produces:
A' -> E''
(F'' is filtered out as it is empty after .gitrepo is removed)
C' has been omitted from the subrepo branch.
This can cause a conflict during rebase if E depends on C.
With this change, we always use the .gitrepo file (subrepo.parent=D, subrepo.commit=C')
when processing E, so the subrepo branch process starts from C', and produces:
A' -> C' -> E''
which will always rebase successfully.
0 commit comments