@Test public void shouldReturnSourceMergeForLocalRef() throws Exception { // given Git git = new Git(repo); git.branchCreate() .setName("test2") .setStartPoint("refs/heads/master") .setUpstreamMode(SetupUpstreamMode.TRACK) .call(); git.checkout().setName("test2").call(); GitSynchronizeData gsd = new GitSynchronizeData(repo, R_HEADS + "test2", HEAD, false); // when String srcMerge = gsd.getSrcMerge(); // then assertThat(srcMerge, is("refs/heads/master")); }
@Test public void shouldReturnSourceMergeForRemoteBranch() throws Exception { // given Git git = new Git(repo); git.branchCreate() .setName("test3") .setStartPoint("refs/heads/master") .setUpstreamMode(SetupUpstreamMode.TRACK) .call(); git.checkout().setName("test3").call(); repo.renameRef(R_HEADS + "test3", Constants.R_REMOTES + "origin/master").rename(); GitSynchronizeData gsd = new GitSynchronizeData(repo, "refs/remotes/origin/master", HEAD, false); // when String srcMerge = gsd.getSrcMerge(); // then assertThat(srcMerge, is("refs/heads/master")); }