diff options
author | Toon Claes <toon@gitlab.com> | 2021-05-21 11:32:44 +0300 |
---|---|---|
committer | Toon Claes <toon@gitlab.com> | 2021-06-18 18:15:09 +0300 |
commit | b0593600e1692b42afbde2b9acacfe998c57f2ee (patch) | |
tree | ee90ba0ea558e5c1300f840800fcf76f3be4986c | |
parent | 4180b903a892ba6590a361b3a2b70e1e079d5429 (diff) |
gittest: Configure default branch to be master
Many tests depend on the fact "master" is the initial branch. To
overcome the case when the user has set anything else in their
git-config, configure git in tests to have "master" as the default
branch.
This change was introduced before in [1], but was unintentionally
removed in [2].
1. 60a218110 (testhelper: Git init with master as default branch,
2021-04-20)
2. c0f88d787 (MustRunCommand should not be used for git commands
execution, 2021-05-11)
-rw-r--r-- | internal/git/gittest/command.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/internal/git/gittest/command.go b/internal/git/gittest/command.go index 07abffb19..10863842b 100644 --- a/internal/git/gittest/command.go +++ b/internal/git/gittest/command.go @@ -33,6 +33,9 @@ func run(t testing.TB, stdin io.Reader, cfg config.Cfg, args ...string) []byte { cmd.Env = append(cmd.Env, "GIT_AUTHOR_DATE=1572776879 +0100", "GIT_COMMITTER_DATE=1572776879 +0100", + "GIT_CONFIG_COUNT=1", + "GIT_CONFIG_KEY_0=init.defaultBranch", + "GIT_CONFIG_VALUE_0=master", ) if stdin != nil { |