MCPcopy
hub / github.com/github/git-sizer / AddAuthorInfo

Function AddAuthorInfo

internal/testutils/repoutils.go:271–281  ·  view source on GitHub ↗

AddAuthorInfo adds environment variables to `cmd.Env` that set the Git author and committer to known values and set the timestamp to `*timestamp`. Then `*timestamp` is moved forward by a minute, so that each commit gets a unique timestamp.

(cmd *exec.Cmd, timestamp *time.Time)

Source from the content-addressed store, hash-verified

269// `*timestamp`. Then `*timestamp` is moved forward by a minute, so
270// that each commit gets a unique timestamp.
271func AddAuthorInfo(cmd *exec.Cmd, timestamp *time.Time) {
272 cmd.Env = append(cmd.Env,
273 "GIT_AUTHOR_NAME=Arthur",
274 "GIT_AUTHOR_EMAIL=arthur@example.com",
275 fmt.Sprintf("GIT_AUTHOR_DATE=%d -0700", timestamp.Unix()),
276 "GIT_COMMITTER_NAME=Constance",
277 "GIT_COMMITTER_EMAIL=constance@example.com",
278 fmt.Sprintf("GIT_COMMITTER_DATE=%d -0700", timestamp.Unix()),
279 )
280 *timestamp = timestamp.Add(60 * time.Second)
281}
282
283// ConfigAdd adds a key-value pair to the gitconfig in `repo`.
284func (repo *TestRepo) ConfigAdd(t *testing.T, key, value string) {

Callers 3

TestTaggedTagsFunction · 0.92
TestFromSubdirFunction · 0.92
TestSubmoduleFunction · 0.92

Calls 1

AddMethod · 0.65

Tested by 3

TestTaggedTagsFunction · 0.74
TestFromSubdirFunction · 0.74
TestSubmoduleFunction · 0.74