Skip to content

Commit

Permalink
directive wip
Browse files Browse the repository at this point in the history
Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
  • Loading branch information
krancour committed Sep 7, 2024
1 parent acb45d8 commit e15bbb7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
10 changes: 2 additions & 8 deletions internal/directives/git_clone_directive.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func (g *gitCloneDirective) run(
case checkout.Branch != "":
ref = checkout.Branch
if err = ensureRemoteBranch(repo, ref); err != nil {
return fmt.Errorf("error preparing branch %s: %w", ref, err)
return fmt.Errorf("error ensuring existence of remote branch %s: %w", ref, err)
}
case checkout.FromFreight:
var desiredOrigin *kargoapi.FreightOrigin
Expand Down Expand Up @@ -151,7 +151,7 @@ func (g *gitCloneDirective) run(
}
}
// Note: We do NOT defer repo.Close() because we want to keep the repository
// around onf the FS for subsequent directives to use. The directive execution
// around on the FS for subsequent directives to use. The directive execution
// engine will handle all work dir cleanup.
return nil
}
Expand Down Expand Up @@ -181,12 +181,6 @@ func ensureRemoteBranch(repo git.BareRepo, branch string) error {
)
}
defer workTree.Close()
if err = workTree.Clear(); err != nil {
return fmt.Errorf(
"error clearing temporary working tree for branch %q of repo %s: %w",
branch, repo.URL(), err,
)
}
if err = workTree.Commit(
"Initial commit",
&git.CommitOptions{AllowEmpty: true},
Expand Down
4 changes: 4 additions & 0 deletions internal/directives/git_commit_directive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,7 @@ func TestGitCommitDirective_Validate(t *testing.T) {
})
}
}

func TestGitCommitDirective_Run(t *testing.T) {

Check warning on line 93 in internal/directives/git_commit_directive_test.go

View workflow job for this annotation

GitHub Actions / lint-go

unused-parameter: parameter 't' seems to be unused, consider removing or renaming it as _ (revive)
// TODO: Test this
}
4 changes: 4 additions & 0 deletions internal/directives/git_overwrite_directive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,7 @@ func TestGitOverwriteDirective_Validate(t *testing.T) {
})
}
}

func TestGitOverwriteDirective_Run(t *testing.T) {

Check warning on line 67 in internal/directives/git_overwrite_directive_test.go

View workflow job for this annotation

GitHub Actions / lint-go

unused-parameter: parameter 't' seems to be unused, consider removing or renaming it as _ (revive)
// TODO: Test this
}
4 changes: 4 additions & 0 deletions internal/directives/git_push_directive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,7 @@ func TestGitPushDirective_Validate(t *testing.T) {
})
}
}

func TestGitPushDirective_Run(t *testing.T) {

Check warning on line 126 in internal/directives/git_push_directive_test.go

View workflow job for this annotation

GitHub Actions / lint-go

unused-parameter: parameter 't' seems to be unused, consider removing or renaming it as _ (revive)
// TODO: Test this
}

0 comments on commit e15bbb7

Please sign in to comment.