Skip to content

Commit e8828ae

Browse files
author
gitopia1c2zfrmhra3spfrc2m5ft64hef30guf60lvtcm3
committed
Merge pull request #26 from git-remote-gitopia/release-v2.1.0
2 parents 0de0e8b + fa6f3a2 commit e8828ae

File tree

3 files changed

+20
-9
lines changed

3 files changed

+20
-9
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
All notable changes will be documented here.
44

5+
## [v2.1.0] - 2025-09-12
6+
7+
- don't attempt to push if there is already a pending packfile update proposal
8+
- set GITOPIA_ENV to prod by default in Makefile
9+
510
## [v2.0.1] - 2025-09-08
611

712
- handle the cases when there is only ref update on chain

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
GITOPIA_ENV ?= testing
1+
GITOPIA_ENV ?= prod
22
LEDGER_ENABLED ?= true
33

44
build_tags = netgo

cmd/git-remote-gitopia/gitopia.go

Lines changed: 14 additions & 8 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 or expired 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
@@ -394,24 +406,19 @@ func (h *GitopiaHandler) Push(remote *core.Remote, refsToPush []core.RefToPush)
394406
RepositoryId: h.remoteRepository.Id,
395407
User: h.wallet.Address(),
396408
})
397-
if err != nil && strings.Contains(err.Error(), "packfile update proposal not found") {
398-
// There is no change in packfile so set packfile cid to old_cid itself
399-
packfileCid = packfileRes.Packfile.OldCid
400-
} else if err != nil {
409+
if err != nil {
401410
return nil, err
402411
}
403412
if packfileUpdateProposalRes != nil {
404413
// Packfile update proposal exists, approve it
405414
msg = append(msg, storagetypes.NewMsgApproveRepositoryPackfileUpdate(h.wallet.Address(), packfileUpdateProposalRes.PackfileUpdateProposal.Id))
406415
}
407-
// If error occurs (e.g., proposal not found), continue without failing
408-
// This handles cases like tag pushes where objects already exist
409416

410417
lfsObjectUpdateProposalRes, err := h.storageClient.LFSObjectUpdateProposalsByRepositoryId(context.Background(), &storagetypes.QueryLFSObjectUpdateProposalsByRepositoryIdRequest{
411418
RepositoryId: h.remoteRepository.Id,
412419
User: h.wallet.Address(),
413420
})
414-
if err != nil && !strings.Contains(err.Error(), "lfs object update proposal not found") {
421+
if err != nil {
415422
return nil, err
416423
}
417424
if lfsObjectUpdateProposalRes != nil {
@@ -420,7 +427,6 @@ func (h *GitopiaHandler) Push(remote *core.Remote, refsToPush []core.RefToPush)
420427
msg = append(msg, storagetypes.NewMsgApproveLFSObjectUpdate(h.wallet.Address(), lfsObjectUpdateProposal.Id))
421428
}
422429
}
423-
// If error occurs (e.g., no LFS proposals), continue without failing
424430
}
425431

426432
if len(setBranches) > 0 {

0 commit comments

Comments
 (0)