From aa4bbc67b3b18604681b6785e51aa018a7880fb1 Mon Sep 17 00:00:00 2001 From: Robin Stocker Date: Sun, 15 Sep 2013 23:26:35 +0200 Subject: Use full branch name when getting ref in BranchTrackingStatus In case there is both a tag and branch called "foo", the tag is returned if calling getRef with the short name. By using refs/heads/foo, the branch is returned. Bug: 417158 Change-Id: I86b4f83955586bb24774fd621f5012499cf67909 Signed-off-by: Robin Stocker Signed-off-by: Matthias Sohn --- org.eclipse.jgit/src/org/eclipse/jgit/lib/BranchTrackingStatus.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'org.eclipse.jgit/src/org/eclipse') diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BranchTrackingStatus.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BranchTrackingStatus.java index 7844fd819f..1525e5b187 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BranchTrackingStatus.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BranchTrackingStatus.java @@ -70,8 +70,10 @@ public class BranchTrackingStatus { public static BranchTrackingStatus of(Repository repository, String branchName) throws IOException { + String shortBranchName = Repository.shortenRefName(branchName); + String fullBranchName = Constants.R_HEADS + shortBranchName; BranchConfig branchConfig = new BranchConfig(repository.getConfig(), - branchName); + shortBranchName); String trackingBranch = branchConfig.getTrackingBranch(); if (trackingBranch == null) @@ -81,7 +83,7 @@ public class BranchTrackingStatus { if (tracking == null) return null; - Ref local = repository.getRef(branchName); + Ref local = repository.getRef(fullBranchName); if (local == null) return null; -- cgit v1.2.3 From a065a06c2aefd0f5c5fc70d3410c3202f4d03268 Mon Sep 17 00:00:00 2001 From: Robin Rosenberg Date: Sun, 17 Mar 2013 21:01:24 +0100 Subject: Attempt to fix graph layout when new heads are introduced Sometime the new commit is no allocated onto a new lane leading to the commit being drawn on the wrong branch and something that looks like a merge. The drawback is that this also changes existing valid graphs. Bug: 368927 Change-Id: Ic8a8247c8a53be802c1be83850ed766b902ca646 --- .../eclipse/jgit/revplot/PlotCommitListTest.java | 51 +++++++++++++++++----- .../org/eclipse/jgit/revplot/PlotCommitList.java | 6 ++- 2 files changed, 46 insertions(+), 11 deletions(-) (limited to 'org.eclipse.jgit/src/org/eclipse') diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/PlotCommitListTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/PlotCommitListTest.java index 5db6b86f81..926424c06d 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/PlotCommitListTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/PlotCommitListTest.java @@ -156,8 +156,8 @@ public class PlotCommitListTest extends RevWalkTestCase { CommitListAssert test = new CommitListAssert(pcl); test.commit(c).lanePos(0).parents(a); - test.commit(b).lanePos(1).parents(a); - test.commit(a).lanePos(0).parents(); + test.commit(b).lanePos(0).parents(a); + test.commit(a).lanePos(1).parents(); test.noMoreCommits(); } @@ -179,9 +179,9 @@ public class PlotCommitListTest extends RevWalkTestCase { CommitListAssert test = new CommitListAssert(pcl); test.commit(d).lanePos(0).parents(a); - test.commit(c).lanePos(1).parents(a); - test.commit(b).lanePos(1).parents(a); - test.commit(a).lanePos(0).parents(); + test.commit(c).lanePos(0).parents(a); + test.commit(b).lanePos(0).parents(a); + test.commit(a).lanePos(1).parents(); test.noMoreCommits(); } @@ -214,14 +214,45 @@ public class PlotCommitListTest extends RevWalkTestCase { CommitListAssert test = new CommitListAssert(pcl); test.commit(g).lanePos(0).parents(f); test.commit(f).lanePos(0).parents(a); - test.commit(e).lanePos(1).parents(a); - test.commit(d).lanePos(1).parents(a); - test.commit(c).lanePos(1).parents(a); - test.commit(b).lanePos(1).parents(a); - test.commit(a).lanePos(0).parents(); + test.commit(e).lanePos(0).parents(a); + test.commit(d).lanePos(0).parents(a); + test.commit(c).lanePos(0).parents(a); + test.commit(b).lanePos(0).parents(a); + test.commit(a).lanePos(1).parents(); test.noMoreCommits(); } + @Test + public void testBug368927() throws Exception { + final RevCommit a = commit(); + final RevCommit b = commit(a); + final RevCommit c = commit(b); + final RevCommit d = commit(b); + final RevCommit e = commit(c); + final RevCommit f = commit(e, d); + final RevCommit g = commit(a); + final RevCommit h = commit(f); + final RevCommit i = commit(h); + + PlotWalk pw = new PlotWalk(db); + pw.markStart(pw.lookupCommit(i.getId())); + pw.markStart(pw.lookupCommit(g.getId())); + + PlotCommitList pcl = new PlotCommitList(); + pcl.source(pw); + pcl.fillTo(Integer.MAX_VALUE); + CommitListAssert test = new CommitListAssert(pcl); + test.commit(i).lanePos(1).parents(h); + test.commit(h).lanePos(1).parents(f); + test.commit(g).lanePos(0).parents(a); + test.commit(f).lanePos(1).parents(e, d); + test.commit(e).lanePos(0).parents(c); + test.commit(d).lanePos(1).parents(b); + test.commit(c).lanePos(0).parents(b); + test.commit(b).lanePos(1).parents(a); + test.commit(a).lanePos(2).parents(); + } + // test the history of the egit project between 9fdaf3c1 and e76ad9170f @Test public void testEgitHistory() throws Exception { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommitList.java b/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommitList.java index 382d162439..943ec4ec3f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommitList.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommitList.java @@ -119,8 +119,12 @@ public class PlotCommitList extends setupChildren(currCommit); final int nChildren = currCommit.getChildCount(); - if (nChildren == 0) + if (nChildren == 0) { + currCommit.lane = nextFreeLane(); + activeLanes.add(currCommit.lane); + closeLane(currCommit.lane); return; + } if (nChildren == 1 && currCommit.children[0].getParentCount() < 2) { // Only one child, child has only us as their parent. -- cgit v1.2.3 From c6aba99668eab76c1b05e021719f8ef9a69c3ae9 Mon Sep 17 00:00:00 2001 From: Stefan Lay Date: Fri, 27 Sep 2013 10:55:56 +0200 Subject: Fix order of commits in rebase todo file header Change-Id: I0e41d89bbd4fc01ad3b3d05a45ee60af853bfae7 Signed-off-by: Matthias Sohn --- org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'org.eclipse.jgit/src/org/eclipse') diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java index 5a006792e1..a3f80c0f09 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java @@ -669,8 +669,8 @@ public class RebaseCommand extends GitCommand { BufferedWriter fw = new BufferedWriter(new OutputStreamWriter( new FileOutputStream(rebaseState.getFile(GIT_REBASE_TODO)), Constants.CHARACTER_ENCODING)); - fw.write("# Created by EGit: rebasing " + upstreamCommit.name() - + " onto " + headId.name()); + fw.write("# Created by EGit: rebasing " + headId.name() + " onto " + + upstreamCommit.name()); fw.newLine(); try { StringBuilder sb = new StringBuilder(); -- cgit v1.2.3