From 49276b91166e37ade59e2e9d45a456720a6d5d90 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Sat, 23 Dec 2023 01:13:41 +0100 Subject: [PATCH] add git-lfs as test dep to ci --- .woodpecker/test.yml | 3 ++- cmd/wp-git-clone/flags.go | 1 + docs/data/data.yaml | 1 + git/init.go | 14 +++----------- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/.woodpecker/test.yml b/.woodpecker/test.yml index 00bc5ac..9b6c8db 100644 --- a/.woodpecker/test.yml +++ b/.woodpecker/test.yml @@ -14,5 +14,6 @@ steps: - name: test image: docker.io/library/golang:1.21 commands: - - apk --update add --no-cache git git-lfs + - apt-get update + - apt-get install -y --no-install-recommends git git-lfs - make test diff --git a/cmd/wp-git-clone/flags.go b/cmd/wp-git-clone/flags.go index 3df38db..9a9aecb 100644 --- a/cmd/wp-git-clone/flags.go +++ b/cmd/wp-git-clone/flags.go @@ -147,6 +147,7 @@ func settingsFlags(settings *plugin.Settings, category string) []cli.Flag { Usage: "change branch name", EnvVars: []string{"PLUGIN_BRANCH", "CI_COMMIT_BRANCH", "CI_REPO_DEFAULT_BRANCH"}, Destination: &settings.Repo.Branch, + Value: "main", Category: category, }, &cli.BoolFlag{ diff --git a/docs/data/data.yaml b/docs/data/data.yaml index bd0478d..b7d9f02 100644 --- a/docs/data/data.yaml +++ b/docs/data/data.yaml @@ -3,6 +3,7 @@ properties: - name: branch description: | Change branch name. + defaultvalue: "main" - name: ci_netrc_machine description: | diff --git a/git/init.go b/git/init.go index 26298d3..bd3b9c9 100644 --- a/git/init.go +++ b/git/init.go @@ -8,20 +8,12 @@ import ( func Init(repo Repository) *execabs.Cmd { args := []string{ "init", + "-b", + repo.Branch, } - if repo.Branch != "" { - args = []string{ - "init", - "-b", - repo.Branch, - } - } - - cmd := execabs.Command( + return execabs.Command( gitBin, args..., ) - - return cmd }