-
Notifications
You must be signed in to change notification settings - Fork 12
Add support for git-flow-next #46
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
Conversation
…e version checks and user prompts for unsupported versions.
- Updated GitInitLineHandler to support case-insensitive matching for various branch prompts, improving user experience during initialization. - Modified GitflowVersionTester to clarify version support checks, ensuring only maintained versions are recognized. - Added plugin.xml for Git Flow Integration Plus, defining plugin metadata and dependencies. - Created UI forms for various Gitflow actions, including AbstractBranchStartDialog, AbstractGitflowActionAckDialog, GitflowBranchChooseDialog, GitflowCloseTaskPanel, GitflowInitOptionsDialog, GitflowOpenTaskPanel, and GitflowOptionsForm, enhancing the user interface for Gitflow operations.
… in GitflowConfigUtil and InitRepoAction
…development branches based on existing local branches
|
It was edited by GitHub Copilot in Agent mode, because I'm not Java dev, but I use this plugin) I tested it and it works like a charm) |
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.
Pull Request Overview
This pull request adds support for the modern git-flow-next implementation alongside the existing AVH version. The changes detect and adapt to git-flow-next's configuration schema while maintaining backward compatibility with AVH.
- Extends version detection to recognize
git-flow-nextas a supported implementation - Updates configuration reading to handle both legacy AVH and new git-flow-next config keys
- Improves initialization dialog with smarter branch selection that prioritizes "main" over "master"
Reviewed Changes
Copilot reviewed 12 out of 20 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/gitflow/GitflowVersionTester.java | Extended version check to recognize git-flow-next in addition to AVH |
| src/main/java/gitflow/GitflowConfigUtil.java | Added dual config key support for both AVH and git-flow-next formats |
| src/main/java/gitflow/GitInitLineHandler.java | Made prompt matching case-insensitive to handle variations between implementations |
| src/main/java/gitflow/ui/GitflowInitOptionsDialog.java | Implemented smart branch selection favoring modern naming conventions |
| src/main/java/gitflow/actions/InitRepoAction.java | Added config reload logic and sequencing to ensure widget updates correctly |
| src/main/java/gitflow/ui/GitflowWidget.java | Added debug logging and updated unsupported version dialog message |
| src/main/java/gitflow/ui/UnsupportedVersionWidgetPresentation.java | Enhanced error message with installation guidance |
| README.md | Updated documentation to recommend git-flow-next |
| GITFLOW_VERSION.md | Rewrote installation guide for git-flow-next |
| gradle.properties | Added Java home configuration |
| docs/git-flow-next-validation.md | New validation documentation |
| bin/main/*.form | New UI form files (binary/build artifacts) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| List<String> productionBranches = Arrays.asList("main", "master", "production"); | ||
| List<String> developmentBranches = Arrays.asList("develop", "development", "dev"); | ||
|
|
||
| // Add existing local branches to the options | ||
| for (String branch : localBranches) { | ||
| if (!productionBranches.contains(branch)) { | ||
| productionBranches = new java.util.ArrayList<>(productionBranches); | ||
| ((java.util.ArrayList<String>) productionBranches).add(branch); | ||
| } | ||
| if (!developmentBranches.contains(branch)) { | ||
| developmentBranches = new java.util.ArrayList<>(developmentBranches); | ||
| ((java.util.ArrayList<String>) developmentBranches).add(branch); |
Copilot
AI
Nov 5, 2025
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 loop creates a new ArrayList on every iteration when a branch is added. Initialize mutable lists before the loop to avoid unnecessary object creation and improve performance.
| List<String> productionBranches = Arrays.asList("main", "master", "production"); | |
| List<String> developmentBranches = Arrays.asList("develop", "development", "dev"); | |
| // Add existing local branches to the options | |
| for (String branch : localBranches) { | |
| if (!productionBranches.contains(branch)) { | |
| productionBranches = new java.util.ArrayList<>(productionBranches); | |
| ((java.util.ArrayList<String>) productionBranches).add(branch); | |
| } | |
| if (!developmentBranches.contains(branch)) { | |
| developmentBranches = new java.util.ArrayList<>(developmentBranches); | |
| ((java.util.ArrayList<String>) developmentBranches).add(branch); | |
| List<String> productionBranches = new java.util.ArrayList<>(Arrays.asList("main", "master", "production")); | |
| List<String> developmentBranches = new java.util.ArrayList<>(Arrays.asList("develop", "development", "dev")); | |
| // Add existing local branches to the options | |
| for (String branch : localBranches) { | |
| if (!productionBranches.contains(branch)) { | |
| productionBranches.add(branch); | |
| } | |
| if (!developmentBranches.contains(branch)) { | |
| developmentBranches.add(branch); |
| // Debug logging | ||
| System.out.println("GitflowWidget.update() - hasGitflow: " + hasGitflow); | ||
| if (gitflowBranchUtil != null) { | ||
| System.out.println(" - master: " + gitflowBranchUtil.getBranchnameMaster()); | ||
| System.out.println(" - develop: " + gitflowBranchUtil.getBranchnameDevelop()); | ||
| System.out.println(" - feature prefix: " + gitflowBranchUtil.getPrefixFeature()); | ||
| } |
Copilot
AI
Nov 5, 2025
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.
System.out.println should not be used in production code. Replace with proper logging using a logger instance (e.g., Logger.getInstance(GitflowWidget.class)).
| if (result.success()) { | ||
| String successMessage = getSuccessMessage(); | ||
|
|
||
| System.out.println("InitRepoAction: Git flow init success"); |
Copilot
AI
Nov 5, 2025
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.
System.out.println should not be used in production code. Replace with proper logging using a logger instance (e.g., Logger.getInstance(InitRepoAction.class)).
| GitflowConfigUtil gitflowConfigUtil = GitflowConfigUtil.getInstance(myProject, myRepo); | ||
| gitflowConfigUtil.update(); | ||
|
|
||
| System.out.println("InitRepoAction: Config updated - master=" + gitflowConfigUtil.masterBranch + ", develop=" + gitflowConfigUtil.developBranch); |
Copilot
AI
Nov 5, 2025
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.
System.out.println should not be used in production code. Replace with proper logging using a logger instance (e.g., Logger.getInstance(InitRepoAction.class)).
|
|
||
| // Update the widget AFTER config is reloaded - use invokeLater to ensure UI update | ||
| ApplicationManager.getApplication().invokeLater(() -> { | ||
| System.out.println("InitRepoAction: Notifying repository changed"); |
Copilot
AI
Nov 5, 2025
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.
System.out.println should not be used in production code. Replace with proper logging using a logger instance (e.g., Logger.getInstance(InitRepoAction.class)).
| // For git-flow-next, branch names are hardcoded to "main" and "develop" | ||
| if (isGitflowNext) { | ||
| masterBranch = "main"; | ||
| developBranch = "develop"; |
Copilot
AI
Nov 5, 2025
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.
Hard-coding branch names to 'main' and 'develop' for git-flow-next may not be correct. The comment states 'branch names are hardcoded' but git-flow-next typically allows customization. Verify this assumption is correct or read the actual configured branch names from git-flow-next config.
| // For git-flow-next, branch names are hardcoded to "main" and "develop" | |
| if (isGitflowNext) { | |
| masterBranch = "main"; | |
| developBranch = "develop"; | |
| // For git-flow-next, read branch names from config (do not hardcode) | |
| if (isGitflowNext) { | |
| masterBranch = GitConfigUtil.getValue(project, root, "gitflow.branch.main"); | |
| if (masterBranch == null) { | |
| masterBranch = "main"; | |
| } | |
| developBranch = GitConfigUtil.getValue(project, root, "gitflow.branch.develop"); | |
| if (developBranch == null) { | |
| developBranch = "develop"; | |
| } |
| boolean hasGitflow = gitflowBranchUtil.hasGitflow(); | ||
|
|
||
| // Debug logging | ||
| System.out.println("GitflowWidget.update() - hasGitflow: " + hasGitflow); | ||
| if (gitflowBranchUtil != null) { | ||
| System.out.println(" - master: " + gitflowBranchUtil.getBranchnameMaster()); | ||
| System.out.println(" - develop: " + gitflowBranchUtil.getBranchnameDevelop()); | ||
| System.out.println(" - feature prefix: " + gitflowBranchUtil.getPrefixFeature()); | ||
| } |
Copilot
AI
Nov 5, 2025
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.
Variable gitflowBranchUtil may be null at this access as suggested by this null guard.
| boolean hasGitflow = gitflowBranchUtil.hasGitflow(); | |
| // Debug logging | |
| System.out.println("GitflowWidget.update() - hasGitflow: " + hasGitflow); | |
| if (gitflowBranchUtil != null) { | |
| System.out.println(" - master: " + gitflowBranchUtil.getBranchnameMaster()); | |
| System.out.println(" - develop: " + gitflowBranchUtil.getBranchnameDevelop()); | |
| System.out.println(" - feature prefix: " + gitflowBranchUtil.getPrefixFeature()); | |
| } | |
| if (gitflowBranchUtil == null) { | |
| myText = "No Gitflow"; | |
| myTooltip = getDisplayableBranchTooltip(repo); | |
| return; | |
| } | |
| boolean hasGitflow = gitflowBranchUtil.hasGitflow(); | |
| // Debug logging | |
| System.out.println("GitflowWidget.update() - hasGitflow: " + hasGitflow); | |
| System.out.println(" - master: " + gitflowBranchUtil.getBranchnameMaster()); | |
| System.out.println(" - develop: " + gitflowBranchUtil.getBranchnameDevelop()); | |
| System.out.println(" - feature prefix: " + gitflowBranchUtil.getPrefixFeature()); |
| ((java.util.ArrayList<String>) productionBranches).add(branch); | ||
| } | ||
| if (!developmentBranches.contains(branch)) { | ||
| developmentBranches = new java.util.ArrayList<>(developmentBranches); | ||
| ((java.util.ArrayList<String>) developmentBranches).add(branch); |
Copilot
AI
Nov 5, 2025
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.
List is cast to the concrete type ArrayList, losing abstraction.
| ((java.util.ArrayList<String>) productionBranches).add(branch); | |
| } | |
| if (!developmentBranches.contains(branch)) { | |
| developmentBranches = new java.util.ArrayList<>(developmentBranches); | |
| ((java.util.ArrayList<String>) developmentBranches).add(branch); | |
| productionBranches.add(branch); | |
| } | |
| if (!developmentBranches.contains(branch)) { | |
| developmentBranches = new java.util.ArrayList<>(developmentBranches); | |
| developmentBranches.add(branch); |
| List<String> productionBranches = Arrays.asList("main", "master", "production"); | ||
| List<String> developmentBranches = Arrays.asList("develop", "development", "dev"); | ||
|
|
||
| // Add existing local branches to the options | ||
| for (String branch : localBranches) { | ||
| if (!productionBranches.contains(branch)) { | ||
| productionBranches = new java.util.ArrayList<>(productionBranches); | ||
| ((java.util.ArrayList<String>) productionBranches).add(branch); | ||
| } | ||
| if (!developmentBranches.contains(branch)) { | ||
| developmentBranches = new java.util.ArrayList<>(developmentBranches); | ||
| ((java.util.ArrayList<String>) developmentBranches).add(branch); |
Copilot
AI
Nov 5, 2025
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.
List is cast to the concrete type ArrayList, losing abstraction.
| List<String> productionBranches = Arrays.asList("main", "master", "production"); | |
| List<String> developmentBranches = Arrays.asList("develop", "development", "dev"); | |
| // Add existing local branches to the options | |
| for (String branch : localBranches) { | |
| if (!productionBranches.contains(branch)) { | |
| productionBranches = new java.util.ArrayList<>(productionBranches); | |
| ((java.util.ArrayList<String>) productionBranches).add(branch); | |
| } | |
| if (!developmentBranches.contains(branch)) { | |
| developmentBranches = new java.util.ArrayList<>(developmentBranches); | |
| ((java.util.ArrayList<String>) developmentBranches).add(branch); | |
| List<String> productionBranches = new java.util.ArrayList<>(Arrays.asList("main", "master", "production")); | |
| List<String> developmentBranches = new java.util.ArrayList<>(Arrays.asList("develop", "development", "dev")); | |
| // Add existing local branches to the options | |
| for (String branch : localBranches) { | |
| if (!productionBranches.contains(branch)) { | |
| productionBranches.add(branch); | |
| } | |
| if (!developmentBranches.contains(branch)) { | |
| developmentBranches.add(branch); |
RubinCarter
left a comment
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.
Hi @AlexRaycan, thank you for this PR! The git-flow-next support implementation looks good overall.
I noticed a couple of minor issues that should be addressed before merging:
1. Build artifacts should not be committed
The following files appear to be Gradle build outputs and should be removed from the PR:
bin/main/META-INF/plugin.xml
bin/main/gitflow/ui/AbstractBranchStartDialog.form
bin/main/gitflow/ui/AbstractGitflowActionAckDialog.form
bin/main/gitflow/ui/GitflowBranchChooseDialog.form
bin/main/gitflow/ui/GitflowCloseTaskPanel.form
bin/main/gitflow/ui/GitflowInitOptionsDialog.form
bin/main/gitflow/ui/GitflowOpenTaskPanel.form
bin/main/gitflow/ui/GitflowOptionsForm.form
These are generated files that get created during the build process. They shouldn't be tracked in version control.
2. IDE configuration files should not be committed
.vscode/settings.json
This is a personal IDE configuration file. It's best practice to keep these out of the repository (they're usually in .gitignore).
Could you please remove these files from your PR? You can do this with:
git rm -r bin/
git rm -r .vscode/
git commit --amend
git push --forceThanks again for your contribution! 🙏
…tionsDialog to support custom branch names and improve fallback priorities
a23b59b to
06a1d50
Compare
- Add git-flow-next config compatibility layer in GitflowConfigUtil - Smart branch detection for init dialog (prioritize main over master) - Improve init prompt matching for different git-flow implementations - Force config reload after init to ensure widget updates correctly Co-authored-by: AlexRaycan <alex@example.com>
|
Hi @AlexRaycan, Thanks again for this great PR! I've merged the core changes from your work into the https://github.com/RubinCarter/gitflow4idea-plus/releases/tag/v0.8.1-beta.2 What was merged:✅ Still need your action:Before I can fully merge this PR, please remove the build artifacts and IDE config files: git rm -r bin/
git rm -r .vscode/
git commit --amend
git push --forceOr I can close this PR since the important changes are already in Thanks for contributing to git-flow-next support! 🙏 |
|
Thanks for cleaning up the PR! The build artifacts and IDE config files have been removed. ✅ Since I've already merged the core changes into Thanks again for the git-flow-next support! 🎉 |
|
Closing this PR as the core changes have been manually merged into Your contributions are included:
Credit in commit: 241fdf9 Thank you for your contribution! 🙏 |
|
Hi! I ran your commands 😅, so I'm not sure why it didn't work 🥲. If possible, please test all functions, as I may have missed something. |
|
Hi @AlexRaycan, Thanks for confirming! Yes, you did run those commands correctly - I can see the I apologize for the confusing messages earlier - I posted the cleanup request before I noticed you had already done it! Regarding testing: I've already tested the core functionality and released it as v0.8.1-beta.2. The changes are working well:
If any issues come up during user testing, I'll let you know. Thanks again for your contribution! 🙏 |
Fixes #45
This PR adds support for git-flow-next version of git-flow.
Changes:
Testing: