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/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:88eda0e6-60b0-4512-7067-db32e7b74b8b |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | D574:C53D0:18BF46B:229D2B2:6970DCA0 |
| html-safe-nonce | d83b120a04438bf601c3b1c33dc965f75e81ed4841efa8b8154811a6302e02f5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENTc0OkM1M0QwOjE4QkY0NkI6MjI5RDJCMjo2OTcwRENBMCIsInZpc2l0b3JfaWQiOiI4ODk2MjcyOTM4NTg3NzA4NTc2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | fbc62f49480399ef9692f2f38a9144d133da3cd3f58d00c83e9aec6ba73479a1 |
| hovercard-subject-tag | pull_request:110254184 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/files |
| 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 | b9203e7efc62065329c3b7015a1e6d16fc14bce440abec7b0d3cbe9e4fb1e2e4 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | eb3c92b74ae48a78cffd8700b8eb5f60bad61528 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width