1

Is there a way in Github v4 API to get all the commits after a given commit?

I have tried this, but it doesn't give me any result.

{
  repository(owner: "karthikeayan", name: "puhar-petti") {
    ref(qualifiedName: "master") {
      target {
        ... on Commit {
          history(last: 100, before: "d1b7ccc044be72490525a3fe1b819440f4927cba 0") {
            pageInfo {
              startCursor
              endCursor
            }
            edges {
              node {
                oid
                messageHeadline
                messageBody
              }
            }
          }
        }
      }
    }
  }
}

With git log I can accomplish this by doing

git log d1b7ccc044be72490525a3fe1b819440f4927cba..HEAD
Benjamin Loison
  • 3,782
  • 4
  • 16
  • 33
karthikeayan
  • 4,291
  • 7
  • 37
  • 75
  • i found something interesting... looks like this is not possible.. https://stackoverflow.com/questions/48948949/get-the-metadata-for-the-first-n-commits-in-a-remote-git-repository – karthikeayan May 10 '18 at 21:05

1 Answers1

0

In my experiments, the before cursor is ignored.

In v4 you can search forward by pages, as in this query.graphql gist.

history(first: 100, after: "d1b7ccc044be72490525a3fe1b819440f4927cba 0") {
 ...
}

In v3 you might be able to use the Search Commits API that is being previewed. However, it only searches the default branch.

Benjamin Loison
  • 3,782
  • 4
  • 16
  • 33
Joe Bowbeer
  • 3,574
  • 3
  • 36
  • 47