Skip to content

Commit

Permalink
Ensure json is returned even when there's no changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nazunalika committed Jun 10, 2024
1 parent 7c1d85b commit ab57fbe
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions pkg/srpmproc/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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
}
}
Expand Down

0 comments on commit ab57fbe

Please sign in to comment.