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

Improve support for fetching refspecs of merge/pull requests from git (self-hosted) forges #182

Open
MisterDA opened this issue May 17, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@MisterDA
Copy link
Contributor

Git forges have a different naming scheme for merge/pull requests.

  • GitlLab:

    fetch = +refs/merge-requests/*/head:refs/remotes/origin/merge-requests/*
    
  • GitHub:

    fetch = +refs/pull/*:refs/remotes/pull/*
    
  • Gogs/Gitea use the same scheme as GitHub.

  • Bitbucket

    • not supported on BitBucket Cloud (bitbucket.com) BCLOUD-5814;
    • supported on BitBucket Stash (self-hosted) with yet another scheme (doc):
      fetch +refs/pull-requests/*/from:refs/remotes/origin/pr/*
      

This is handled in worker/context.ml, which simply inspects the remote URL. Considering that we're mainly dealing with github.com, gitlab.com, and self-hosted GitLab instances, we check and default to their refspecs in that order.

There's apparently no standard way with git to query the remote for more info (e.g., the type of forge). We could hackishly inspect the headers for certain strings, or use forges REST/GraphQL API for self-hosted domains to detect which kind of refspec it's using.

@tmcgilchrist tmcgilchrist added the enhancement New feature or request label May 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants