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

We should default to main branches too #491

Open
Pi-Cla opened this issue May 4, 2024 · 1 comment
Open

We should default to main branches too #491

Pi-Cla opened this issue May 4, 2024 · 1 comment

Comments

@Pi-Cla
Copy link

Pi-Cla commented May 4, 2024

Currently obs_scm seems to only default to branches named master but not main hence me needing to add an extra line to specify that I am targetting the main branch.

I think obs_scm should try master first and then if that fails fall back on main rather than require the user to debug what went wrong.

This code works:

<service mode="localonly" name="obs_scm">
    <param name="url">https://github.com/gleam-lang/gleam.git</param>
    <param name="versionformat">@PARENT_TAG@+git@TAG_OFFSET@</param>
    <param name="scm">git</param>
    <param name="revision">main</param>
    <param name="match-tag">*</param>
    <param name="versionrewrite-pattern">v(\d+\.\d+\.\d+)</param>
    <param name="versionrewrite-replacement">\1</param>
  </service>

but not this:

<service mode="localonly" name="obs_scm">
    <param name="url">https://github.com/gleam-lang/gleam.git</param>
    <param name="versionformat">@PARENT_TAG@+git@TAG_OFFSET@</param>
    <param name="scm">git</param>
    <param name="match-tag">*</param>
    <param name="versionrewrite-pattern">v(\d+\.\d+\.\d+)</param>
    <param name="versionrewrite-replacement">\1</param>
  </service>
@Thaodan
Copy link

Thaodan commented Jun 15, 2024

Instead of using an if then else fallback approach it is also possible to get the default branch by parsing orgin/HEAD
using: git rev-parse --abbrev-ref origin/HEAD

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

No branches or pull requests

2 participants