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

feat: added fork mode #128

Merged
merged 19 commits into from
Jun 14, 2021
Merged

feat: added fork mode #128

merged 19 commits into from
Jun 14, 2021

Conversation

lindell
Copy link
Owner

@lindell lindell commented Jun 5, 2021

  • 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

@lindell lindell added the work in progress Work in progress label Jun 5, 2021
@lindell lindell mentioned this pull request Jun 5, 2021
@lindell lindell changed the title [WIP] feat: added fork mode feat: added fork mode Jun 13, 2021
@lindell lindell removed the work in progress Work in progress label Jun 13, 2021
@lindell
Copy link
Owner Author

lindell commented Jun 13, 2021

@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? :)

@dorner
Copy link

dorner commented Jun 14, 2021

Sure! I'm far from an expert (I've only done two small projects so far) but I'll give it a whirl.

Copy link

@dorner dorner left a 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!

cmd/root.go Show resolved Hide resolved
@@ -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)
Copy link

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 :)

Copy link
Owner Author

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.

Copy link

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.

Copy link
Owner Author

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 :)

internal/scm/gitea/gitea.go Show resolved Hide resolved
internal/scm/github/github.go Outdated Show resolved Hide resolved
internal/scm/gitlab/gitlab.go Show resolved Hide resolved
@lindell
Copy link
Owner Author

lindell commented Jun 14, 2021

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!

@lindell lindell merged commit f9e7827 into master Jun 14, 2021
@lindell lindell deleted the fork-mode branch June 14, 2021 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants