<commit_before>package testlib

import (
	"testing"
	"time"

	"github.com/goreleaser/goreleaser/internal/git"
	"github.com/stretchr/testify/require"
)

// GitInit inits a new git project.
func GitInit(t testing.TB) {
	out, err := fakeGit("init")
	require.NoError(t, err)
	require.Contains(t, out, "Initialized empty Git repository")
	require.NoError(t, err)
}

// GitRemoteAdd adds the given url as remote.
func GitRemoteAdd(t testing.TB, url string) {
	out, err := fakeGit("remote", "add", "origin", url)
	require.NoError(t, err)
	require.Empty(t, out)
}

// GitCommit creates a git commits.
func GitCommit(t testing.TB, msg string) {
	GitCommitWithDate(t, msg, time.Time{})
}

// GitCommitWithDate creates a git commit with a commit date.
func GitCommitWithDate(t testing.TB, msg string, commitDate time.Time) {
	env := (map[string]string)(nil)
	if !commitDate.IsZero() {
		env = map[string]string{
			"GIT_COMMITTER_DATE": commitDate.Format(time.RFC1123Z),
		}
	}
	out, err := fakeGitEnv(env, "commit", "--allow-empty", "-m", msg)
	require.NoError(t, err)
	require.Contains(t, out, "master", msg)
}

// GitTag creates a git tag.
func GitTag(t testing.TB, tag string) {
	out, err := fakeGit("tag", tag)
	require.NoError(t, err)
	require.Empty(t, out)
}
<commit_msg>test: use main as git branch for tests (#2083)<commit_after>package testlib

import (
	"testing"
	"time"

	"github.com/goreleaser/goreleaser/internal/git"
	"github.com/stretchr/testify/require"
)

// GitInit inits a new git project.
func GitInit(t testing.TB) {
	out, err := fakeGit("init", "-b", "main")
	require.NoError(t, err)
	require.Contains(t, out, "Initialized empty Git repository")
	require.NoError(t, err)
}

// GitRemoteAdd adds the given url as remote.
func GitRemoteAdd(t testing.TB, url string) {
	out, err := fakeGit("remote", "add", "origin", url)
	require.NoError(t, err)
	require.Empty(t, out)
}

// GitCommit creates a git commits.
func GitCommit(t testing.TB, msg string) {
	GitCommitWithDate(t, msg, time.Time{})
}

// GitCommitWithDate creates a git commit with a commit date.
func GitCommitWithDate(t testing.TB, msg string, commitDate time.Time) {
	env := (map[string]string)(nil)
	if !commitDate.IsZero() {
		env = map[string]string{
			"GIT_COMMITTER_DATE": commitDate.Format(time.RFC1123Z),
		}
	}
	out, err := fakeGitEnv(env, "commit", "--allow-empty", "-m", msg)
	require.NoError(t, err)
	require.Contains(t, out, "main", msg)
}

// GitTag creates a git tag.
func GitTag(t testing.TB, tag string) {
	out, err := fakeGit("tag", tag)
	require.NoError(t, err)
	require.Empty(t, out)
}

{'fraction_non_alphanumeric': 0.15393563396665375, 'fraction_numerical': 0.0046529662659945716, 'mean_word_length': 4.536480686695279, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5413078', 'n_tokens_mistral': 988, 'n_tokens_neox': 961, 'n_words': 248}