Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@
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;
Expand Down Expand Up @@ -1497,7 +1496,7 @@ public boolean mergeBranch(String value, MergeStrategy mergeStrategy) throws Hop
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);
}
}

Expand Down Expand Up @@ -1792,8 +1791,7 @@ public RevCommit resolve(String commitId) {
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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
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;
Expand All @@ -45,6 +46,7 @@
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;
Expand Down Expand Up @@ -767,6 +769,27 @@ public void testCreateDeleteBranchTag() throws Exception {
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();
Expand Down
Loading