From ab57fbe33b4c2b32816f27dc60746a424278f320 Mon Sep 17 00:00:00 2001 From: Louis Abel Date: Mon, 10 Jun 2024 16:12:51 -0700 Subject: [PATCH] Ensure json is returned even when there's no changes --- pkg/srpmproc/process.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/pkg/srpmproc/process.go b/pkg/srpmproc/process.go index 0695c77..e4b4e20 100644 --- a/pkg/srpmproc/process.go +++ b/pkg/srpmproc/process.go @@ -666,6 +666,11 @@ func ProcessRPM(pd *data.ProcessData) (*srpmprocpb.ProcessResponse, error) { if !pd.ModuleMode { if status.IsClean() { pd.Log.Printf("No changes detected. Our downstream is up to date.") + head, err := repo.Head() + if err != nil { + return nil, fmt.Errorf("error getting HEAD: %v", err) + } + latestHashForBranch[md.PushBranch] = head.Hash().String() continue } } @@ -1002,13 +1007,18 @@ func processRPMTagless(pd *data.ProcessData) (*srpmprocpb.ProcessResponse, error err = w.AddWithOptions(&git.AddOptions{All: true}) if err != nil { - return nil, fmt.Errorf("Error adding SOURCES/ , SPECS/ or .metadata file to commit list.") + return nil, fmt.Errorf("error adding SOURCES/ , SPECS/ or .metadata file to commit list") } - status, err := w.Status() + status, _ := w.Status() if !pd.ModuleMode { if status.IsClean() { pd.Log.Printf("No changes detected. Our downstream is up to date.") + head, err := pushRepo.Head() + if err != nil { + return nil, fmt.Errorf("error getting HEAD: %v", err) + } + latestHashForBranch[md.PushBranch] = head.Hash().String() continue } }