Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force local headings to over-ride remote #185

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions USER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,3 +274,5 @@ You can specify a `redirect` URL in the .DEREK.yml file, this instructs derek to
apply local overrides and additions to the config set in the remote file.

For example, to add a contributor to that repo (in addition to the existing contributors) you can specify the remote file and also add the `maintainers` section to your local file. These lists will then be merged, giving all users in the merged set access to derek.

The exception to the rule in the merging of configs is in the `required_in_issues` feature where the locally configured values will fully override any and all values set in the remote config.
4 changes: 4 additions & 0 deletions types/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,9 @@ func MergeDerekRepoConfigs(localConfig, remoteConfig DerekRepoConfig) (DerekRepo
return remoteConfig, mergeErr
}

if len(localConfig.RequiredInIssues) > 0 {
remoteConfig.RequiredInIssues = localConfig.RequiredInIssues
}

return remoteConfig, nil
}
24 changes: 24 additions & 0 deletions types/merge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,27 @@ func Test_mergeDerekRepoConfigs_ConfigValuesAppendedToList(t *testing.T) {
}

}

func Test_mergeDerekRepoConfigs_UseLocalHeadings(t *testing.T) {

remote := DerekRepoConfig{
RequiredInIssues: []string{
"#1",
"#2",
},
}
local := DerekRepoConfig{
RequiredInIssues: []string{
"#2",
},
}

got, err := MergeDerekRepoConfigs(local, remote)

if err != nil {
t.Errorf("Got error for a single plan, expected no error: %s", err.Error())
}
if len(got.RequiredInIssues) != len(local.RequiredInIssues) {
t.Errorf("RequiredInIssues want %s, but got %s", local.RequiredInIssues, got.RequiredInIssues)
}
}