Commit 799f6955 authored by Erik Seliger's avatar Erik Seliger Committed by GitHub

Fix SIGSEGV in changeset spec validation for imported changesets (#465)

parent 5bd42cd3
......@@ -17,6 +17,8 @@ All notable changes to `src-cli` are documented in this file.
### Fixed
- Importing changesets was broken in the previous release and caused a SIGSEGV error.
### Removed
## 3.24.4
......
......@@ -425,8 +425,12 @@ func (svc *Service) ValidateChangesetSpecs(repos []*graphql.Repository, specs []
byRepoAndBranch := make(map[string]map[string][]*ChangesetSpec)
for _, spec := range specs {
_, ok := byRepoAndBranch[spec.HeadRepository]
if !ok {
// We don't need to validate imported changesets, as they can
// never have a critical branch name overlap.
if spec.ExternalChangeset != nil {
continue
}
if _, ok := byRepoAndBranch[spec.HeadRepository]; !ok {
byRepoAndBranch[spec.HeadRepository] = make(map[string][]*ChangesetSpec)
}
......
......@@ -537,6 +537,16 @@ func TestService_ValidateChangesetSpecs(t *testing.T) {
},
},
"imported changeset": {
repos: []*graphql.Repository{repo1},
specs: []*ChangesetSpec{
{ExternalChangeset: &ExternalChangeset{
ExternalID: "123",
}},
},
// This should not fail validation ever.
},
"duplicate branches": {
repos: []*graphql.Repository{repo1, repo2},
specs: []*ChangesetSpec{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment