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

Error cloning repositories without branch "master" #444

Closed
GabrielDyck opened this issue Sep 23, 2021 · 3 comments
Closed

Error cloning repositories without branch "master" #444

GabrielDyck opened this issue Sep 23, 2021 · 3 comments

Comments

@GabrielDyck
Copy link

GabrielDyck commented Sep 23, 2021

Hi!

I have an issue when flag GIT_SYNC_BRANCH is not set. This component requires know an existing branch of a repository or the repo must have a branch named "master".

Nowaways, new projects are created with main branch instead of master, and when we use this tool it throws an error.

I reviewed the repo and in this function

// CloneRepo does an initial clone of the git repo.
func (git *repoSync) CloneRepo(ctx context.Context) error {
args := []string{"clone", "--no-checkout", "-b", git.branch}

and this line

_, err := git.run.Run(ctx, git.root, git.cmd, "worktree", "add", worktreePath, "origin/"+git.branch, "--no-checkout")

we can make git.branch optional and also change default value from "master" to "" in GIT_SYNC_BRANCH param.

I did some tests with modified code and it worked fine.

Let me know your thoughts.

Thank you in advance!

@GabrielDyck GabrielDyck changed the title Problem with repositories without branch master Error cloning repositories without branch "master" Sep 24, 2021
@thockin
Copy link
Member

thockin commented Sep 24, 2021 via email

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 28, 2021
@thockin thockin removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 3, 2022
@thockin
Copy link
Member

thockin commented Feb 19, 2022

Dup of #286

@thockin thockin closed this as completed Feb 19, 2022
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

No branches or pull requests

4 participants