Skip to content

Conversation

@AlexRaycan
Copy link

Fixes #45

This PR adds support for git-flow-next version of git-flow.

Changes:

  • Added detection of git-flow-next by checking for \gitflow.branch.main.type\ config key
  • For git-flow-next, use hardcoded branch names (\main\ and \develop) instead of reading from config
  • Added fallback logic to support both old git-flow AVH and new git-flow-next config formats
  • Updated init dialog to use smart defaults: detect existing branches (main/master, develop/dev) and use them as defaults
  • When 'Use non-default configuration' is enabled, show dropdown lists with popular branch names + existing branches

Testing:

  • Tested with empty repository (no commits)
  • Tested with existing main branch
  • Tested with existing master branch
  • Widget correctly shows 'Gitflow' status after initialization
  • All git-flow operations (start feature, finish feature, etc.) work correctly

AlexRaycan and others added 5 commits November 5, 2025 08:19
…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.
…development branches based on existing local branches
Copilot AI review requested due to automatic review settings November 5, 2025 10:03
@AlexRaycan
Copy link
Author

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)

Copy link

Copilot AI left a 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-next as 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.

Comment on lines +83 to +94
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);
Copy link

Copilot AI Nov 5, 2025

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.

Suggested change
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);

Copilot uses AI. Check for mistakes.
Comment on lines 215 to 221
// 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());
}
Copy link

Copilot AI Nov 5, 2025

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)).

Copilot uses AI. Check for mistakes.
if (result.success()) {
String successMessage = getSuccessMessage();

System.out.println("InitRepoAction: Git flow init success");
Copy link

Copilot AI Nov 5, 2025

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)).

Copilot uses AI. Check for mistakes.
GitflowConfigUtil gitflowConfigUtil = GitflowConfigUtil.getInstance(myProject, myRepo);
gitflowConfigUtil.update();

System.out.println("InitRepoAction: Config updated - master=" + gitflowConfigUtil.masterBranch + ", develop=" + gitflowConfigUtil.developBranch);
Copy link

Copilot AI Nov 5, 2025

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)).

Copilot uses AI. Check for mistakes.

// Update the widget AFTER config is reloaded - use invokeLater to ensure UI update
ApplicationManager.getApplication().invokeLater(() -> {
System.out.println("InitRepoAction: Notifying repository changed");
Copy link

Copilot AI Nov 5, 2025

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)).

Copilot uses AI. Check for mistakes.
Comment on lines 98 to 101
// For git-flow-next, branch names are hardcoded to "main" and "develop"
if (isGitflowNext) {
masterBranch = "main";
developBranch = "develop";
Copy link

Copilot AI Nov 5, 2025

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.

Suggested change
// 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";
}

Copilot uses AI. Check for mistakes.
Comment on lines 213 to 221
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());
}
Copy link

Copilot AI Nov 5, 2025

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.

Suggested change
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());

Copilot uses AI. Check for mistakes.
Comment on lines +90 to +94
((java.util.ArrayList<String>) productionBranches).add(branch);
}
if (!developmentBranches.contains(branch)) {
developmentBranches = new java.util.ArrayList<>(developmentBranches);
((java.util.ArrayList<String>) developmentBranches).add(branch);
Copy link

Copilot AI Nov 5, 2025

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.

Suggested change
((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);

Copilot uses AI. Check for mistakes.
Comment on lines +83 to +94
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);
Copy link

Copilot AI Nov 5, 2025

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.

Suggested change
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);

Copilot uses AI. Check for mistakes.
Copy link
Owner

@RubinCarter RubinCarter left a 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 --force

Thanks again for your contribution! 🙏

…tionsDialog to support custom branch names and improve fallback priorities
@AlexRaycan AlexRaycan force-pushed the feature/git-flow-next branch from a23b59b to 06a1d50 Compare January 27, 2026 21:23
RubinCarter added a commit that referenced this pull request Jan 28, 2026
- 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>
@RubinCarter
Copy link
Owner

Hi @AlexRaycan,

Thanks again for this great PR! I've merged the core changes from your work into the develop branch and released v0.8.1-beta.2:

https://github.com/RubinCarter/gitflow4idea-plus/releases/tag/v0.8.1-beta.2

What was merged:

GitflowConfigUtil.java - git-flow-next config compatibility layer
GitflowInitOptionsDialog.java - Smart branch detection (main > master)
InitRepoAction.java - Config reload after init
GitInitLineHandler.java - Case-insensitive prompt matching

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 --force

Or I can close this PR since the important changes are already in develop. Let me know your preference!

Thanks for contributing to git-flow-next support! 🙏

@RubinCarter
Copy link
Owner

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 develop and released v0.8.1-beta.2, I'll close this PR now. Your contribution is credited in the commit:

241fdf9

Thanks again for the git-flow-next support! 🎉

@RubinCarter
Copy link
Owner

Closing this PR as the core changes have been manually merged into develop and released as v0.8.1-beta.2.

Your contributions are included:

  • Git-flow-next config compatibility layer
  • Smart branch detection for init dialog (main > master)
  • Case-insensitive prompt matching for different git-flow implementations
  • Config reload after init

Credit in commit: 241fdf9

Thank you for your contribution! 🙏

@AlexRaycan
Copy link
Author

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.

@RubinCarter RubinCarter reopened this Jan 28, 2026
@RubinCarter
Copy link
Owner

Hi @AlexRaycan,

Thanks for confirming! Yes, you did run those commands correctly - I can see the bin/ and .vscode/ folders were successfully removed from the PR. 👍

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:

  • ✅ Git-flow-next config detection
  • ✅ Smart branch detection (main > master priority)
  • ✅ Case-insensitive prompt matching
  • ✅ Config reload after init

If any issues come up during user testing, I'll let you know. Thanks again for your contribution! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

support git-flow-next

2 participants