This is an automated email from the ASF dual-hosted git repository.

bamaer pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hop.git


The following commit(s) were added to refs/heads/main by this push:
     new a0f42232d1 Ask for confirmation before deleting a branch from the 
status bar menu (#9181)
a0f42232d1 is described below

commit a0f42232d12911e8e88709b4c9c0e0ff40a09f00
Author: Ankit Garg <[email protected]>
AuthorDate: Sat Oct 31 13:20:03 2026 +0530

    Ask for confirmation before deleting a branch from the status bar menu 
(#9181)
    
    Only offer local branches other than the current one, and confirm the
    deletion like the Git perspective does.
    
    Fixes #8930
---
 .../main/java/org/apache/hop/git/GitGuiPlugin.java    | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git 
a/plugins/misc/git/src/main/java/org/apache/hop/git/GitGuiPlugin.java 
b/plugins/misc/git/src/main/java/org/apache/hop/git/GitGuiPlugin.java
index 3190c82739..932562458d 100644
--- a/plugins/misc/git/src/main/java/org/apache/hop/git/GitGuiPlugin.java
+++ b/plugins/misc/git/src/main/java/org/apache/hop/git/GitGuiPlugin.java
@@ -921,7 +921,13 @@ public class GitGuiPlugin
     if (git == null) {
       return;
     }
-    List<String> branches = git.getBranches();
+    // Only local branches other than the current one can be deleted
+    List<String> branches = git.getLocalBranches();
+    if (branches == null) {
+      return;
+    }
+    String currentBranch = git.getBranch();
+    branches = branches.stream().filter(b -> 
!b.equals(currentBranch)).toList();
     EnterSelectionDialog selectionDialog =
         new EnterSelectionDialog(
             HopGui.getInstance().getShell(),
@@ -930,6 +936,17 @@ public class GitGuiPlugin
             BaseMessages.getString(PKG, 
"GitGuiPlugin.Dialog.Branch.DeleteBranch.Message"));
     String branchToDelete = selectionDialog.open();
     if (branchToDelete != null) {
+      MessageBox confirmation =
+          new MessageBox(HopGui.getInstance().getShell(), SWT.ICON_QUESTION | 
SWT.YES | SWT.NO);
+      confirmation.setText(
+          BaseMessages.getString(
+              PKG, 
"GitGuiPlugin.Dialog.Branch.DeleteBranchConfirmation.Header"));
+      confirmation.setMessage(
+          BaseMessages.getString(
+              PKG, 
"GitGuiPlugin.Dialog.Branch.DeleteBranchConfirmation.Message", branchToDelete));
+      if (confirmation.open() != SWT.YES) {
+        return;
+      }
       boolean branchDeleted = git.deleteBranch(branchToDelete, true);
       if (branchDeleted) {
         MessageBox pullSuccessful =

Reply via email to