11

Git ハブ リポジトリを操作する自動化サービスに取り組んでいます。そして、私は自分の側で問題を抱えています-特定のブランチのすべてのコミットをそのハッシュ\名前で取得する方法が見つかりません。

My code is an automated tool to make code reviewes. So I've added a feature to ignore particular branch in my review process (ex. a testing branch or something like that). So in my service I am marking branch as ignored. Once I get commits from git hub api - there is no information there about which branch is current commit belongs to.

I started thinking that my overall github idea is wrong - since commit-branch link is pretty obvious thing so there should be something that made the API developers to ignore that in the GetCommits method

So my question is - Is there a way to find out which branch commit (using v3 api json result) belongs to in github api (v3 - GET /repos/:owner/:repo/commits/:sha).

Thanks

4

3 に答える 3

11

現在、GitHub の API には、特定のブランチの履歴にコミットがあるかどうかを確認する方法がありません。あなたができる唯一のことは、特定のブランチのすべてのコミットを取得し、コミットを繰り返し処理して、特定のコミットがリストにあるかどうかを確認することです。これを行うには、へのリクエストを行います/repos/:owner/:repo/commits?sha=branchname。ここで、branchname はコミットをフェッチするブランチの名前ですhttps://api.github.com/repos/izuzak/pmrpc/commits?sha=master

于 2013-05-13T12:20:53.413 に答える
7

たとえば、コミットがブランチ test123 にあるかどうかを確認したいだけの場合は、次のようにします。

https://api.github.com/repos/golang/go/compare/test123...001a75a74c4a27901b0b536efe1be581612c52a9

そして状態を確認。

「同一」または「背後」の場合、コミットはブランチの一部です。違うならそうじゃない。

于 2015-09-17T12:49:53.217 に答える