From 5f0116a7dacd4e02b2e267bce2105ea31db00412 Mon Sep 17 00:00:00 2001 From: faza Date: Tue, 9 Sep 2025 00:17:11 +0530 Subject: [PATCH 1/5] Don't attempt to push if there is already a pending packfile update proposal --- cmd/git-remote-gitopia/gitopia.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cmd/git-remote-gitopia/gitopia.go b/cmd/git-remote-gitopia/gitopia.go index b97e606..ddc9625 100644 --- a/cmd/git-remote-gitopia/gitopia.go +++ b/cmd/git-remote-gitopia/gitopia.go @@ -256,6 +256,18 @@ func (h *GitopiaHandler) Push(remote *core.Remote, refsToPush []core.RefToPush) return nil, fmt.Errorf("fatal: you don't have write permissions to this repository") } + // Check for existing pending packfile update proposal + _, err = h.storageClient.PackfileUpdateProposal(context.Background(), &storagetypes.QueryPackfileUpdateProposalRequest{ + RepositoryId: h.remoteRepository.Id, + User: h.wallet.Address(), + }) + if err == nil { + 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") + } + if !strings.Contains(err.Error(), "packfile update proposal not found") { + return nil, fmt.Errorf("error checking for pending proposals: %v", err) + } + gitServerHost, err := config.GitConfigGet(config.GitopiaConfigGitServerHostOption) if err != nil { return nil, err From 1531e416d82e7b8f6a125dab3b273d8527b7f2e6 Mon Sep 17 00:00:00 2001 From: faza Date: Tue, 9 Sep 2025 03:27:31 +0530 Subject: [PATCH 2/5] Even if there is no storage update, there will be packfile update proposal with cid same as old cid --- cmd/git-remote-gitopia/gitopia.go | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/cmd/git-remote-gitopia/gitopia.go b/cmd/git-remote-gitopia/gitopia.go index ddc9625..b6a39e4 100644 --- a/cmd/git-remote-gitopia/gitopia.go +++ b/cmd/git-remote-gitopia/gitopia.go @@ -262,7 +262,7 @@ func (h *GitopiaHandler) Push(remote *core.Remote, refsToPush []core.RefToPush) User: h.wallet.Address(), }) if err == nil { - 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") + 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") } if !strings.Contains(err.Error(), "packfile update proposal not found") { return nil, fmt.Errorf("error checking for pending proposals: %v", err) @@ -406,24 +406,19 @@ func (h *GitopiaHandler) Push(remote *core.Remote, refsToPush []core.RefToPush) RepositoryId: h.remoteRepository.Id, User: h.wallet.Address(), }) - if err != nil && strings.Contains(err.Error(), "packfile update proposal not found") { - // There is no change in packfile so set packfile cid to old_cid itself - packfileCid = packfileRes.Packfile.OldCid - } else if err != nil { + if err != nil { return nil, err } if packfileUpdateProposalRes != nil { // Packfile update proposal exists, approve it msg = append(msg, storagetypes.NewMsgApproveRepositoryPackfileUpdate(h.wallet.Address(), packfileUpdateProposalRes.PackfileUpdateProposal.Id)) } - // If error occurs (e.g., proposal not found), continue without failing - // This handles cases like tag pushes where objects already exist lfsObjectUpdateProposalRes, err := h.storageClient.LFSObjectUpdateProposalsByRepositoryId(context.Background(), &storagetypes.QueryLFSObjectUpdateProposalsByRepositoryIdRequest{ RepositoryId: h.remoteRepository.Id, User: h.wallet.Address(), }) - if err != nil && !strings.Contains(err.Error(), "lfs object update proposal not found") { + if err != nil { return nil, err } if lfsObjectUpdateProposalRes != nil { @@ -432,7 +427,6 @@ func (h *GitopiaHandler) Push(remote *core.Remote, refsToPush []core.RefToPush) msg = append(msg, storagetypes.NewMsgApproveLFSObjectUpdate(h.wallet.Address(), lfsObjectUpdateProposal.Id)) } } - // If error occurs (e.g., no LFS proposals), continue without failing } if len(setBranches) > 0 { From 74d346ebcc63272b4e2d0e7be60e7d0af5018a82 Mon Sep 17 00:00:00 2001 From: faza Date: Wed, 10 Sep 2025 21:27:27 +0530 Subject: [PATCH 3/5] Set GITOPIA_ENV to prod by default in Makefile --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index f2d2e10..63802c4 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -GITOPIA_ENV ?= testing +GITOPIA_ENV ?= prod LEDGER_ENABLED ?= true build_tags = netgo @@ -42,7 +42,7 @@ zip = cd build && zip $(appname)_$(version)_$(1)_$(2).zip $(appname)$(3) git-git .PHONY: build -all: darwin linux git_release_tar_gz git_release_zip +all: darwin git_release_tar_gz git_release_zip clean: rm -rf build/ From d69a2a4000e2dacd99223d104603a71f4047382f Mon Sep 17 00:00:00 2001 From: faza Date: Fri, 12 Sep 2025 19:10:22 +0530 Subject: [PATCH 4/5] add linux in makefile all rule --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 63802c4..4be7b2c 100644 --- a/Makefile +++ b/Makefile @@ -42,7 +42,7 @@ zip = cd build && zip $(appname)_$(version)_$(1)_$(2).zip $(appname)$(3) git-git .PHONY: build -all: darwin git_release_tar_gz git_release_zip +all: darwin linux git_release_tar_gz git_release_zip clean: rm -rf build/ From fa6f3a206c134124b25cf6fdf6b4f9f52b92a3a0 Mon Sep 17 00:00:00 2001 From: faza Date: Fri, 12 Sep 2025 19:12:34 +0530 Subject: [PATCH 5/5] chore: add changelog entry for v2.1.0 --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce5c27d..1c3e583 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ All notable changes will be documented here. +## [v2.1.0] - 2025-09-12 + +- don't attempt to push if there is already a pending packfile update proposal +- set GITOPIA_ENV to prod by default in Makefile + ## [v2.0.1] - 2025-09-08 - handle the cases when there is only ref update on chain