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: Getting main branch OID for repository #14

Closed
jacobsimpson-addepar-jenkinsx-bot opened this issue Jun 21, 2021 · 6 comments
Closed
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@jacobsimpson-addepar-jenkinsx-bot
Copy link

jacobsimpson-addepar-jenkinsx-bot commented Jun 21, 2021

Nice work, I like where you are going with this.

I'm having a little trouble getting it going on one of my repos.

$ git branchless init 
$ git sl
Error: Getting main branch OID for repository

Caused by:
    cannot locate remote-tracking branch 'master'; class=Reference (4); code=NotFound (-3)

I suspect this is happening because my main branch is named main not master.

Now that the repository is git branchless init, branchless error messages are appearing for other commands too:

$ git rebase --onto main 4bfe550 b1
branchless: processing 1 update to a branch/ref
branchless: processing 1 update to a branch/ref
branchless: processing 1 update to a branch/ref
dropping 05a699a Generate. -- patch contents already upstream
branchless: processing 1 update to a branch/ref
branchless: processing 1 update to a branch/ref
branchless: processing 1 update to a branch/ref
branchless: processing commit
branchless: processing 1 update to a branch/ref
branchless: processing 1 update to a branch/ref
branchless: processing 2 rewritten commits
Error: Processing post-rewrite hook

Caused by:
    0: Getting main branch OID for repository
    1: cannot locate remote-tracking branch 'master'; class=Reference (4); code=NotFound (-3)
Successfully rebased and updated refs/heads/b1.

Thank you.

@arxanas
Copy link
Owner

arxanas commented Jun 21, 2021

Will address in more detail later, try git config branchless.mainBranch main

@arxanas arxanas added enhancement New feature or request good first issue Good for newcomers labels Jun 22, 2021
@arxanas
Copy link
Owner

arxanas commented Jun 22, 2021

I suppose this is two issues:

  • The error message could be clearer here, and suggest some steps for remediation.
  • git branchless init should autodetect the correct branch name (one of the items mentioned in Known issues #1).

I'll see if I can get to this sometime soon.

@jacobsimpson-addepar
Copy link

git config branchless.mainBranch main did it. smartlog is now working for me. Haven't tried the others yet.

@sassman
Copy link

sassman commented Jun 22, 2021

same issue happens also on a repo that has never been yet pushed upstream (hence has no remote tracking branch)

@arxanas arxanas self-assigned this Jun 23, 2021
@arxanas
Copy link
Owner

arxanas commented Jun 25, 2021

I've tried to improve the experience here in #31 by 1) auto-detecting the main branch name, and 2) printing a more actionable, less misleading message. (The error message is complaining that it can't find a remote branch like origin/master, not that it can't find a local remote-tracking branch like master synced to origin/master.)

@arxanas
Copy link
Owner

arxanas commented Jun 25, 2021

Resolved in #31.

@arxanas arxanas closed this as completed Jun 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants