summaryrefslogtreecommitdiffstats
path: root/pkg/integration/tests/filter_by_author/shared.go
blob: 160bde1c04bf2932c8e12a2e9ac89b7a2d7c18de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package filter_by_author

import (
	"fmt"
	"strings"

	. "github.com/jesseduffield/lazygit/pkg/integration/components"
)

type AuthorInfo struct {
	name            string
	numberOfCommits int
}

func commonSetup(shell *Shell) {
	authors := []AuthorInfo{{"Yang Wen-li", 3}, {"Siegfried Kircheis", 1}, {"Paul Oberstein", 8}}
	totalCommits := 0
	repoStartDaysAgo := 100

	for _, authorInfo := range authors {
		for i := 0; i < authorInfo.numberOfCommits; i++ {
			authorEmail := strings.ToLower(strings.ReplaceAll(authorInfo.name, " ", ".")) + "@email.com"
			commitMessage := fmt.Sprintf("commit %d", i)

			shell.SetAuthor(authorInfo.name, authorEmail)
			shell.EmptyCommitDaysAgo(commitMessage, repoStartDaysAgo-totalCommits)
			totalCommits++
		}
	}
}