Skip to content

Commit a671c28

Browse files
committed
Handle nil packfile response
1 parent 404d017 commit a671c28

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

cmd/git-remote-gitopia/gitopia.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,22 +365,26 @@ func (h *GitopiaHandler) Push(remote *core.Remote, refsToPush []core.RefToPush)
365365
}
366366
}
367367

368-
packfileRes, _ := h.storageClient.RepositoryPackfile(context.Background(), &storagetypes.QueryRepositoryPackfileRequest{
368+
var packfileCid string
369+
packfileRes, err := h.storageClient.RepositoryPackfile(context.Background(), &storagetypes.QueryRepositoryPackfileRequest{
369370
RepositoryId: h.remoteRepository.Id,
370371
})
372+
if err == nil {
373+
packfileCid = packfileRes.Packfile.Cid
374+
}
371375

372376
var msg []sdk.Msg
373377
if len(setBranches) > 0 {
374378
msg = append(msg, gitopiatypes.NewMsgMultiSetBranch(h.wallet.Address(), gitopiatypes.RepositoryId{
375379
Id: h.remoteRepository.Owner.Id,
376380
Name: h.remoteRepository.Name,
377-
}, setBranches, packfileRes.Packfile.Cid))
381+
}, setBranches, packfileCid))
378382
}
379383
if len(setTags) > 0 {
380384
msg = append(msg, gitopiatypes.NewMsgMultiSetTag(h.wallet.Address(), gitopiatypes.RepositoryId{
381385
Id: h.remoteRepository.Owner.Id,
382386
Name: h.remoteRepository.Name,
383-
}, setTags, packfileRes.Packfile.Cid))
387+
}, setTags, packfileCid))
384388
}
385389
if len(deleteBranches) > 0 {
386390
msg = append(msg, gitopiatypes.NewMsgMultiDeleteBranch(h.wallet.Address(), gitopiatypes.RepositoryId{

0 commit comments

Comments
 (0)