You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hop.apache.org by ha...@apache.org on 2026/10/19 08:39:45 UTC

(hop) branch main updated: Issue #8937 : Merging a tag with conflicts no longer shows an error dialog or fails on an annotated tag (#9010)

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

hansva 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 5b62a0c211 Issue #8937 : Merging a tag with conflicts no longer shows an error dialog or fails on an annotated tag (#9010)
5b62a0c211 is described below

commit 5b62a0c2114786655eefa7580ca285f0075d2c8b
Author: Sai Asish Y <sa...@gmail.com>
AuthorDate: Mon Oct 19 01:39:39 2026 -0700

    Issue #8937 : Merging a tag with conflicts no longer shows an error dialog or fails on an annotated tag (#9010)
    
    Signed-off-by: Sai Asish Y <sa...@gmail.com>
---
 .../main/java/org/apache/hop/git/model/UIGit.java  |  6 ++----
 .../java/org/apache/hop/git/model/UIGitTest.java   | 23 ++++++++++++++++++++++
 2 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/plugins/misc/git/src/main/java/org/apache/hop/git/model/UIGit.java b/plugins/misc/git/src/main/java/org/apache/hop/git/model/UIGit.java
index dd3b3d8318..e67e4c0a77 100644
--- a/plugins/misc/git/src/main/java/org/apache/hop/git/model/UIGit.java
+++ b/plugins/misc/git/src/main/java/org/apache/hop/git/model/UIGit.java
@@ -94,7 +94,6 @@ import org.eclipse.jgit.lib.StoredConfig;
 import org.eclipse.jgit.lib.UserConfig;
 import org.eclipse.jgit.merge.MergeStrategy;
 import org.eclipse.jgit.revwalk.RevCommit;
-import org.eclipse.jgit.revwalk.RevObject;
 import org.eclipse.jgit.revwalk.RevTree;
 import org.eclipse.jgit.revwalk.RevWalk;
 import org.eclipse.jgit.transport.CredentialsProvider;
@@ -1497,7 +1496,7 @@ public class UIGit extends VCS {
         Map<String, int[][]> conflicts = result.getConflicts();
         for (String path : conflicts.keySet()) {
           checkout(path, Constants.HEAD, CONST_OURS);
-          checkout(path, getExpandedName(value, VCS.TYPE_BRANCH), CONST_THEIRS);
+          checkout(path, obj.getName(), CONST_THEIRS);
         }
       }
 
@@ -1792,8 +1791,7 @@ public class UIGit extends VCS {
       e1.printStackTrace();
     }
     try (RevWalk rw = new RevWalk(git.getRepository())) {
-      RevObject obj = rw.parseAny(id);
-      return (RevCommit) obj;
+      return rw.parseCommit(id);
     } catch (IOException e) {
       e.printStackTrace();
     }
diff --git a/plugins/misc/git/src/test/java/org/apache/hop/git/model/UIGitTest.java b/plugins/misc/git/src/test/java/org/apache/hop/git/model/UIGitTest.java
index ab9beeac27..338eccb096 100644
--- a/plugins/misc/git/src/test/java/org/apache/hop/git/model/UIGitTest.java
+++ b/plugins/misc/git/src/test/java/org/apache/hop/git/model/UIGitTest.java
@@ -28,6 +28,7 @@ import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
@@ -45,6 +46,7 @@ import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.IOUtils;
 import org.apache.hop.core.exception.HopException;
 import org.apache.hop.git.model.revision.ObjectRevision;
+import org.apache.hop.i18n.BaseMessages;
 import org.apache.hop.ui.core.dialog.EnterSelectionDialog;
 import org.eclipse.jgit.api.Git;
 import org.eclipse.jgit.api.RemoteAddCommand;
@@ -767,6 +769,27 @@ public class UIGitTest extends RepositoryTestCase {
     assertFalse(tags.contains("test"));
   }
 
+  @Test
+  public void testMergeAnnotatedTagWithConflict() throws Exception {
+    initialCommit();
+    git.checkout().setCreateBranch(true).setName("feature").call();
+    writeTrashFile("Test.txt", "Change on feature");
+    git.add().addFilepattern("Test.txt").call();
+    git.commit().setMessage("Change on feature").call();
+    git.tag().setName("v1").setAnnotated(true).setMessage("Version 1").call();
+    git.checkout().setName(Constants.MASTER).call();
+    writeTrashFile("Test.txt", "Change on master");
+    git.add().addFilepattern("Test.txt").call();
+    git.commit().setMessage("Change on master").call();
+
+    // The merge conflicts: the .theirs copy comes from the tag and no error dialog is shown
+    assertTrue(uiGit.mergeBranch("v1", MergeStrategy.RECURSIVE));
+    assertEquals("Change on feature", read(new File(db.getWorkTree(), "Test.txt.theirs")));
+    verify(uiGit, never())
+        .showMessageBox(
+            eq(BaseMessages.getString(UIGit.PKG, UIGit.CONST_DIALOG_ERROR)), anyString());
+  }
+
   @Test
   public void testUnstageFilesWithResetPath() throws Exception {
     initialCommit();