Skip to content

Commit

Permalink
Fix bug in loadTasks
Browse files Browse the repository at this point in the history
This also updates the test output which previously reflected incorrect
output which is fixed by this PR.
  • Loading branch information
johnbelamaric committed Nov 28, 2023
1 parent fa49ede commit cdde92f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions e2e/testdata/porch/rpkg-update/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ commands:
stdout: |
NAME PACKAGE WORKSPACENAME REVISION LATEST LIFECYCLE REPOSITORY
git-3f036055f7ba68706372cbe0c4b14d553794f7c4 basens-edit update-1 false Draft git
git-804ab1a9d043e44255ef3fb77820d5ad7b1576a9 basens-edit update-3 main false Published git
git-7fcdd499f0790ac3bd8f805e3e5e00825641eb60 basens-edit update-3 v1 true Published git
git-7ab0219ace10c1081a8b40a6b97d5da58bdb62e0 basens-edit-clone update-2 false Draft git
- args:
Expand All @@ -82,6 +83,7 @@ commands:
stdout: |
PACKAGE REVISION UPSTREAM REPOSITORY UPSTREAM UPDATES
git-3f036055f7ba68706372cbe0c4b14d553794f7c4 No update available
git-804ab1a9d043e44255ef3fb77820d5ad7b1576a9 No update available
git-7fcdd499f0790ac3bd8f805e3e5e00825641eb60 No update available
git-7ab0219ace10c1081a8b40a6b97d5da58bdb62e0 git v1
- args:
Expand Down Expand Up @@ -110,6 +112,7 @@ commands:
stdout: |
PACKAGE REVISION UPSTREAM REPOSITORY UPSTREAM UPDATES
git-3f036055f7ba68706372cbe0c4b14d553794f7c4 No update available
git-804ab1a9d043e44255ef3fb77820d5ad7b1576a9 No update available
git-7fcdd499f0790ac3bd8f805e3e5e00825641eb60 No update available
git-7ab0219ace10c1081a8b40a6b97d5da58bdb62e0 git No update available
- args:
Expand Down
6 changes: 6 additions & 0 deletions porch/pkg/git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -1177,7 +1177,12 @@ func (r *gitRepository) loadTasks(ctx context.Context, startCommit *object.Commi

var tasks []v1alpha1.Task

done := false
visitCommit := func(commit *object.Commit) error {
if done {
return nil
}

gitAnnotations, err := ExtractGitAnnotations(commit)
if err != nil {
return err
Expand All @@ -1202,6 +1207,7 @@ func (r *gitRepository) loadTasks(ctx context.Context, startCommit *object.Commi
if gitAnnotation.Task != nil && (gitAnnotation.Task.Type == v1alpha1.TaskTypeClone || gitAnnotation.Task.Type == v1alpha1.TaskTypeInit) {
// we have reached the beginning of this package revision and don't need to
// continue further
done = true
break
}
}
Expand Down

0 comments on commit cdde92f

Please sign in to comment.