File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -249,9 +249,17 @@ func Load(
249249 // so this needs more careful thought.
250250 continue
251251 }
252- commit , err := repo .CommitObject (plumbing .NewHash (linkedRevision .Revision .HeadCommitSHA ))
252+ headCommitHash := plumbing .NewHash (linkedRevision .Revision .HeadCommitSHA )
253+ commit , err := repo .CommitObject (headCommitHash )
253254 if err != nil {
254- return nil , errors .WithStack (err )
255+ if errors .Is (err , plumbing .ErrObjectNotFound ) {
256+ // If we haven't yet fetched the commit from the remote then
257+ // we fabricate a commit and hope downstream code doesn't
258+ // try to access anything other than the hash.
259+ commit = & object.Commit {Hash : headCommitHash }
260+ } else {
261+ return nil , errors .WithStack (err )
262+ }
255263 }
256264 review := & linkedRevision .Review
257265 s = append (s , CommitInfo {
You can’t perform that action at this time.
0 commit comments