summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdRef.java8
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/Ref.java7
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/SymbolicRef.java4
3 files changed, 13 insertions, 6 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdRef.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdRef.java
index b791c64552..d65c1bdf1a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdRef.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdRef.java
@@ -67,7 +67,7 @@ public abstract class ObjectIdRef implements Ref {
*/
public Unpeeled(@NonNull Storage st, @NonNull String name,
@Nullable ObjectId id) {
- super(st, name, id, -1);
+ super(st, name, id, UNDEFINED_UPDATE_INDEX);
}
/**
@@ -119,7 +119,7 @@ public abstract class ObjectIdRef implements Ref {
*/
public PeeledTag(@NonNull Storage st, @NonNull String name,
@Nullable ObjectId id, @NonNull ObjectId p) {
- super(st, name, id, -1);
+ super(st, name, id, UNDEFINED_UPDATE_INDEX);
peeledObjectId = p;
}
@@ -172,7 +172,7 @@ public abstract class ObjectIdRef implements Ref {
*/
public PeeledNonTag(@NonNull Storage st, @NonNull String name,
@Nullable ObjectId id) {
- super(st, name, id, -1);
+ super(st, name, id, UNDEFINED_UPDATE_INDEX);
}
/**
@@ -284,7 +284,7 @@ public abstract class ObjectIdRef implements Ref {
*/
@Override
public long getUpdateIndex() {
- if (updateIndex == -1) {
+ if (updateIndex == UNDEFINED_UPDATE_INDEX) {
throw new UnsupportedOperationException();
}
return updateIndex;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Ref.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Ref.java
index 32c8b06c91..4082d21c2e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Ref.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Ref.java
@@ -126,6 +126,13 @@ public interface Ref {
}
/**
+ * Update index value when a reference doesn't have one
+ *
+ * @since 5.4
+ */
+ long UNDEFINED_UPDATE_INDEX = -1L;
+
+ /**
* What this ref is called within the repository.
*
* @return name of this ref.
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/SymbolicRef.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/SymbolicRef.java
index 00fcf52037..9f0568f0c2 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/SymbolicRef.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/SymbolicRef.java
@@ -71,7 +71,7 @@ public class SymbolicRef implements Ref {
public SymbolicRef(@NonNull String refName, @NonNull Ref target) {
this.name = refName;
this.target = target;
- this.updateIndex = -1;
+ this.updateIndex = UNDEFINED_UPDATE_INDEX;
}
/**
@@ -155,7 +155,7 @@ public class SymbolicRef implements Ref {
*/
@Override
public long getUpdateIndex() {
- if (updateIndex == -1) {
+ if (updateIndex == UNDEFINED_UPDATE_INDEX) {
throw new UnsupportedOperationException();
}
return updateIndex;