Skip to content

Commit 5f0116a

Browse files
committed
Don't attempt to push if there is already a pending packfile update proposal
1 parent 0de0e8b commit 5f0116a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

cmd/git-remote-gitopia/gitopia.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,18 @@ func (h *GitopiaHandler) Push(remote *core.Remote, refsToPush []core.RefToPush)
256256
return nil, fmt.Errorf("fatal: you don't have write permissions to this repository")
257257
}
258258

259+
// Check for existing pending packfile update proposal
260+
_, err = h.storageClient.PackfileUpdateProposal(context.Background(), &storagetypes.QueryPackfileUpdateProposalRequest{
261+
RepositoryId: h.remoteRepository.Id,
262+
User: h.wallet.Address(),
263+
})
264+
if err == nil {
265+
return nil, fmt.Errorf("fatal: there is already a pending packfile update proposal for this repository. Please wait for it to be processed before pushing again")
266+
}
267+
if !strings.Contains(err.Error(), "packfile update proposal not found") {
268+
return nil, fmt.Errorf("error checking for pending proposals: %v", err)
269+
}
270+
259271
gitServerHost, err := config.GitConfigGet(config.GitopiaConfigGitServerHostOption)
260272
if err != nil {
261273
return nil, err

0 commit comments

Comments
 (0)