Skip to content

get_default_branch: Use HEAD instead of guessing#308

Open
mattcen wants to merge 2 commits into
jonashaag:masterfrom
mattcen:master
Open

get_default_branch: Use HEAD instead of guessing#308
mattcen wants to merge 2 commits into
jonashaag:masterfrom
mattcen:master

Conversation

@mattcen

@mattcen mattcen commented Mar 20, 2023

Copy link
Copy Markdown

Fixes #307

@mattcen

mattcen commented Mar 20, 2023

Copy link
Copy Markdown
Author

Not sure if this is t he nicest way to do things, especially with the decode() and calling head() just so we can catch it if it fails, but it feels less bad than guessing, which is what this replaces. Thoughts and comments welcome.

@jelmer

jelmer commented Mar 20, 2023

Copy link
Copy Markdown
Contributor

Rather than checking the revision that HEAD and other branches point at, you could simply check what HEAD resolves to.

See Repo.refs.follow(b'HEAD')

@mattcen

mattcen commented Mar 23, 2023

Copy link
Copy Markdown
Author

@jelmer Thanks; code updated.

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.

Browsing to a repo shows the most recently updated branch, rather than the default

2 participants