aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefUpdate.java
diff options
context:
space:
mode:
authorRoberto Tyley <roberto.tyley@gmail.com>2014-01-29 00:32:55 +0000
committerGerrit Code Review @ Eclipse.org <gerrit@eclipse.org>2014-02-13 18:05:03 -0500
commit2b722815c9b6e3f8e50a081404265fb5b56b60e8 (patch)
treeead7e450a46ca63fda7dfe9f4660ddc74b94b01c /org.eclipse.jgit/src/org/eclipse/jgit/lib/RefUpdate.java
parent47f47ffc07e00109dc069e111274252e4053a599 (diff)
downloadjgit-2b722815c9b6e3f8e50a081404265fb5b56b60e8.tar.gz
jgit-2b722815c9b6e3f8e50a081404265fb5b56b60e8.zip
Non-Fast-Forward Ref-Updates: Omit isMergedInto() calls
When the caller specifies to JGit in advance that a ref-update is a non-fast-forward update, and that those are permitted, we should never need to call the potentially expensive isMergedInto() check. Re-checking that the older commit is /not/ reachable from the newer is superfluous. http://dev.eclipse.org/mhonarc/lists/jgit-dev/msg02258.html Change-Id: I4bbf593de4dcea6b6f082881c1a33cb3a6a7fb89 Signed-off-by: Roberto Tyley <roberto.tyley@gmail.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/lib/RefUpdate.java')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/RefUpdate.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefUpdate.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefUpdate.java
index 8d59cb47b4..f47dff75a8 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefUpdate.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefUpdate.java
@@ -620,13 +620,14 @@ public abstract class RefUpdate {
if (newObj == oldObj && !detachingSymbolicRef)
return store.execute(Result.NO_CHANGE);
+ if (isForceUpdate())
+ return store.execute(Result.FORCED);
+
if (newObj instanceof RevCommit && oldObj instanceof RevCommit) {
if (walk.isMergedInto((RevCommit) oldObj, (RevCommit) newObj))
return store.execute(Result.FAST_FORWARD);
}
- if (isForceUpdate())
- return store.execute(Result.FORCED);
return Result.REJECTED;
} finally {
unlock();