Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create remote branch when mirroring to remote if missing #958

Open
minwoox opened this issue May 24, 2024 · 0 comments
Open

Create remote branch when mirroring to remote if missing #958

minwoox opened this issue May 24, 2024 · 0 comments

Comments

@minwoox
Copy link
Member

minwoox commented May 24, 2024

Currently, a Central Dogma server raises an exception when mirroring from local to remote if the remote branch doesn't exist:

private static Ref findHeadBranchRef(GitWithAuth git, String headBranchRefName, Collection<Ref> refs) {
final Optional<Ref> headBranchRef = refs.stream()
.filter(ref -> headBranchRefName.equals(ref.getName()))
.findFirst();
if (headBranchRef.isPresent()) {
return headBranchRef.get();
}
throw new MirrorException("Remote does not have " + headBranchRefName + " branch. remote: " +
git.remoteUri());
}

We can probably just create the remote branch as normal git push does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant