jonashaag / klaus

docker run klaus / pip install klaus — the first Git web viewer that Just Works™.
http://klausdemo.lophus.org
Other
685 stars 102 forks source link

get_default_branch: Use HEAD instead of guessing #308

Open mattcen opened 1 year ago

mattcen commented 1 year ago

Fixes #307

mattcen commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

@jelmer Thanks; code updated.