-
Notifications
You must be signed in to change notification settings - Fork 66
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
feat: added fork mode #128
Conversation
lindell
commented
Jun 5, 2021
•
edited
Loading
edited
- Support for forking to custom owner
- Support forking on GitHub
- Support forking on GitLab
- Support forking on Gitea
- Make branch already exist error message work for forks
@dorner I would consider the changes to this PR to be mostly done. I saw that you had some experience with Go. Do you mind taking a look at the code and doing a review on it? :) |
Sure! I'm far from an expert (I've only done two small projects so far) but I'll give it a whirl. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of comments/questions from me. Looks great - you put so much work into this so quickly!
@@ -184,17 +169,36 @@ func (g *Git) logDiff(aHash, bHash plumbing.Hash) error { | |||
} | |||
|
|||
// BranchExist checks if the new branch exists | |||
func (g *Git) BranchExist(branchName string) (bool, error) { | |||
_, err := g.repo.Reference(plumbing.ReferenceName(fmt.Sprintf("refs/remotes/origin/%s", branchName)), false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just want to confirm that this is still used elsewhere in the code; if not, a reminder to delete it :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean the BranchExist
as a whole? In that case yes. It was moved to after the (potential) forking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry - I meant the plumbing.ReferenceName
method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that is a part of the go-git library :)
Thanks :) Supporting forking is something that's been on my mind for some time. Getting confirmation that it was actually needed gave me the motivation to make it happened! |