Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ All notable changes to `src-cli` are documented in this file.
### Fixed

- `src campaigns` output has been improved in the Windows console. [#274](https://github.com/sourcegraph/src-cli/pull/274)
- `src campaigns` will no longer generate warnings if `user.name` or `user.email` have not been set in the global Git configuration. [#277](https://github.com/sourcegraph/src-cli/pull/277)

## 3.18.0

Expand Down
12 changes: 12 additions & 0 deletions internal/campaigns/run_steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,18 @@ func runSteps(ctx context.Context, client api.Client, repo *graphql.Repository,
if _, err := runGitCmd("init"); err != nil {
return nil, errors.Wrap(err, "git init failed")
}

// Set user.name and user.email in the local repository. The user name and
// e-mail will eventually be ignored anyway, since we're just using the Git
// repository to generate diffs, but we don't want git to generate alarming
// looking warnings.
if _, err := runGitCmd("config", "--local", "user.name", "Sourcegraph"); err != nil {
return nil, errors.Wrap(err, "git config user.name failed")
}
if _, err := runGitCmd("config", "--local", "user.email", "campaigns@sourcegraph.com"); err != nil {
return nil, errors.Wrap(err, "git config user.email failed")
}

// --force because we want previously "gitignored" files in the repository
if _, err := runGitCmd("add", "--force", "--all"); err != nil {
return nil, errors.Wrap(err, "git add failed")
Expand Down