Title: `Repository.checkoutBranch` does nothing if branch name matches tag name by rcjsuen · Pull Request #1250 · nodegit/nodegit · GitHub
Open Graph Title: `Repository.checkoutBranch` does nothing if branch name matches tag name by rcjsuen · Pull Request #1250 · nodegit/nodegit
X Title: `Repository.checkoutBranch` does nothing if branch name matches tag name by rcjsuen · Pull Request #1250 · nodegit/nodegit
Description: According to the Git documentation, refs/tags/ will be searched before refs/heads/ when looking up references. As a result, trying to use getReference() in checkoutBranch will fail as it will return the tag instead of the branch. I have included a failing test case that illustrates this problem. Solution A: Prepend refs/heads/ to branch before calling getReference(branch). Result A: Any existing NodeGit clients that currently pass in a fully qualified reference name will be broken in the next release. Solution B: Prepend refs/heads/ to branch before calling getReference(branch) if and only if branch does not already have refs/heads/ as its prefix. Result B: The API contract becomes a little weird. Some clients may want to pass in refs/heads/branch to checkout refs/heads/refs/heads/branch when NodeGit will in fact end up checking out refs/heads/branch. Of course, with the right documentation this might not be ambiguous at all to anyone using the API and most users of Git probably don't have a branch named refs/heads/refs/heads/branch in their repository.
Open Graph Description: According to the Git documentation, refs/tags/ will be searched before refs/heads/ when looking up references. As a result, trying to use getReference() in checkoutBranch will fail as it will retur...
X Description: According to the Git documentation, refs/tags/ will be searched before refs/heads/ when looking up references. As a result, trying to use getReference() in checkoutBranch will fail as it will retur...
Opengraph URL: https://github.com/nodegit/nodegit/pull/1250
X: @github
Domain: patch-diff.githubusercontent.com
| route-pattern | /:user_id/:repository/pull/:id/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:f5806eac-a186-5a2e-6e79-cb74f6280d37 |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | B140:376227:42BE392:5A3F631:697090D6 |
| html-safe-nonce | 2af66be410f8835fd2621fe681b9be155daa8f7fa55e7e903e9616300e6ff098 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMTQwOjM3NjIyNzo0MkJFMzkyOjVBM0Y2MzE6Njk3MDkwRDYiLCJ2aXNpdG9yX2lkIjoiMTEyMTc3ODg0ODgzNjM5MTEyNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 8d6fd2392010c6c0b0fe51930058918e38b7ee6f579bdfdcc14a151a05076140 |
| hovercard-subject-tag | pull_request:110254184 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/nodegit/nodegit/pull/1250/checks |
| twitter:image | https://avatars.githubusercontent.com/u/15629116?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/15629116?s=400&v=4 |
| og:image:alt | According to the Git documentation, refs/tags/ will be searched before refs/heads/ when looking up references. As a result, trying to use getReference() in checkoutBranch will fail as it will retur... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9920a62ba22d06470388e2904804fb7e5ec51c9e35f81784e9191394c74b2bd2 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodegit/nodegit git https://github.com/nodegit/nodegit.git |
| octolytics-dimension-user_id | 657068 |
| octolytics-dimension-user_login | nodegit |
| octolytics-dimension-repository_id | 1383170 |
| octolytics-dimension-repository_nwo | nodegit/nodegit |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1383170 |
| octolytics-dimension-repository_network_root_nwo | nodegit/nodegit |
| turbo-body-classes | logged-out env-production page-responsive full-width full-width-p-0 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7d6181066430cc06553c8396ca201e194ae33cb9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width