-
Notifications
You must be signed in to change notification settings - Fork 19
Allow dots in base branch names #94
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -234,8 +234,8 @@ func LoadConfig() (*Config, error) { | |
| continue | ||
| } | ||
|
|
||
| branchName := strings.ToLower(keyParts[2]) | ||
| property := strings.ToLower(keyParts[3]) | ||
| branchName := strings.ToLower(strings.Join(keyParts[2:len(keyParts)-1], ".")) | ||
| property := strings.ToLower(keyParts[len(keyParts)-1]) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The fix is correct. Minor: the comment on line 231 above ( |
||
|
|
||
| // Initialize branch map if needed | ||
| if _, ok := branchMap[branchName]; !ok { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -270,6 +270,58 @@ func TestApplyOverrides_CustomBranchNames(t *testing.T) { | |||||||||||||||||||||
| assert.False(t, exists) | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
||||||||||||||||||||||
| // TestApplyOverrides_CustomBranchNamesWithDots validates that ApplyOverrides | |
| // correctly updates branch relationships when custom branch names contain dots. | |
| // Steps: | |
| // 1. Create the default configuration. | |
| // 2. Apply overrides using dotted names for the main and develop branches. | |
| // 3. Verify the renamed base branches have the expected type, parent, and start point. | |
| // 4. Verify dependent branch types reference the updated dotted branch names. | |
| // 5. Verify the original default branch names no longer exist in the configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test only exercises ApplyOverrides, not LoadConfig where the parsing fix actually lives. ApplyOverrides already handled dotted names correctly since it just renames map keys.
Add a TestLoadConfigWithDottedBranchNames test (similar to TestLoadConfigCaseInsensitive at line 54) that:
- Sets up a test repo
- Runs
git config gitflow.branch.custom.main.type base(and other properties) - Calls
config.LoadConfig() - Asserts the branch appears as
custom.mainin the loaded config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The updated LoadConfig parsing now supports branch names that contain dots, but there’s no regression test that exercises reading such keys from git config (e.g.,
gitflow.branch.custom.main.type). The new unit test only coversApplyOverrides, which doesn’t validate thegit config --get-regexp gitflow\.branch\.parsing logic; please add a test that writes dotted branch keys into a temp repo and assertsconfig.LoadConfig()(orgit-flow overview) recognizes the base branches correctly.