Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, the first commit has the latest commit with a relative
reference of number of commits being pushed. For example, if the
first event has just 1 commit at sha abcdef, commitFrom is abcdef~1
and commitTo is abcdef.
We use relative references to ensure we can always fetch the diff
even if the oldest commit has been removed (via push). But the first
commit doesn't appear to have a valid diff from any GitHub APIs so
to indicate this, we'll set commitFrom to blank.
When it comes to fetching the diff via the VCSReader interface, if
commitFrom is blank, return a nil io.ReadCloser and nil error.
The frontends already know how to handle lack of a diff, it just
occurs even when there's no error now.
This also relates to #79, which was handling fetching diffs when
the before ref no longer exists, which is the case when a branch
tracks a new tree or a new repository is created. I couldn't
combine the logic much further, because GitHub has no indication
when the commit follows a new tree (the before ref is from the
previous tree, whereas in a new repository it's all 0s).
So I wasn't able to combine any logic between this and #79, but
the integration test was renamed from new-go-repository to new-tree
to better reflect what it was doing.
Fixes #96.
Relates to #79.