diff options
author | Robin Rosenberg <robin.rosenberg@dewire.com> | 2012-09-18 18:00:38 -0400 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org <gerrit@eclipse.org> | 2012-09-18 18:00:38 -0400 |
commit | 1f19d0a834a3add31e40911578f9f547c2466e2b (patch) | |
tree | f5cb7352b48a127dcf6421d0c8622c7ef39d7be6 /org.eclipse.jgit | |
parent | f7b644df66d5f975d858aca3f977f31baf4a2264 (diff) | |
parent | 70ae16d708e0a207035872a16943f8b9151f33cd (diff) | |
download | jgit-1f19d0a834a3add31e40911578f9f547c2466e2b.tar.gz jgit-1f19d0a834a3add31e40911578f9f547c2466e2b.zip |
Merge "Fix resolving expression with ~ and ^ than extends beyond history"
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/lib/EmptyProgressMonitor.java | 74 | ||||
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java | 5 |
2 files changed, 78 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/EmptyProgressMonitor.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/EmptyProgressMonitor.java new file mode 100644 index 0000000000..eabcbbf632 --- /dev/null +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/EmptyProgressMonitor.java @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2012, Sasa Zivkov <sasa.zivkov@sap.com> + * and other copyright owners as documented in the project's IP log. + * + * This program and the accompanying materials are made available + * under the terms of the Eclipse Distribution License v1.0 which + * accompanies this distribution, is reproduced below, and is + * available at http://www.eclipse.org/org/documents/edl-v10.php + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * - Neither the name of the Eclipse Foundation, Inc. nor the + * names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.eclipse.jgit.lib; + +/** + * A convenient base class which provides empty method bodies for all + * ProgressMonitor methods. + * <p> + * Could be used in scenarios when only some of the progress notifications are + * important and others can be ignored. + */ +public abstract class EmptyProgressMonitor implements ProgressMonitor { + + public void start(int totalTasks) { + // empty + } + + public void beginTask(String title, int totalWork) { + // empty + } + + public void update(int completed) { + // empty + } + + public void endTask() { + // empty + } + + public boolean isCancelled() { + return false; + } + +} diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java index 82394dd757..16f8cdfef7 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java @@ -532,6 +532,7 @@ public abstract class Repository { if (name == null) name = new String(revChars, done, i); rev = parseSimple(rw, name); + name = null; if (rev == null) return null; } @@ -588,6 +589,7 @@ public abstract class Repository { // detached name = Constants.HEAD; Ref ref = getRef(name); + name = null; if (ref == null) return null; if (ref.isSymbolic()) @@ -635,6 +637,7 @@ public abstract class Repository { if (name.equals("")) name = Constants.HEAD; Ref ref = getRef(name); + name = null; if (ref == null) return null; // @{n} means current branch, not HEAD@{1} unless @@ -642,7 +645,6 @@ public abstract class Repository { if (ref.isSymbolic()) ref = ref.getLeaf(); rev = resolveReflog(rw, ref, time); - name = null; } i = m; } else @@ -656,6 +658,7 @@ public abstract class Repository { if (name.equals("")) name = Constants.HEAD; rev = parseSimple(rw, name); + name = null; } if (rev == null) return null; |