summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/gitblit/utils
diff options
context:
space:
mode:
authorPaul Martin <paul@paulsputer.com>2016-03-27 17:05:38 +0100
committerPaul Martin <paul@paulsputer.com>2016-03-27 17:09:16 +0100
commit795ce2765773156da868720303a6b2638d14820b (patch)
treed20f4aab7b49721a3390db4a413f6449ed138259 /src/main/java/com/gitblit/utils
parent713d27789bc0b5d82b607fed20e5f16ad9216898 (diff)
downloadgitblit-795ce2765773156da868720303a6b2638d14820b.tar.gz
gitblit-795ce2765773156da868720303a6b2638d14820b.zip
Friendly URL for EditFile Page #974
+ Prevent Edit of old doc version
Diffstat (limited to 'src/main/java/com/gitblit/utils')
-rw-r--r--src/main/java/com/gitblit/utils/JGitUtils.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/main/java/com/gitblit/utils/JGitUtils.java b/src/main/java/com/gitblit/utils/JGitUtils.java
index 3aaad6d7..90d40020 100644
--- a/src/main/java/com/gitblit/utils/JGitUtils.java
+++ b/src/main/java/com/gitblit/utils/JGitUtils.java
@@ -2727,5 +2727,22 @@ public class JGitUtils {
}
return success;
}
+
+ /**
+ * Returns true if the commit identified by commitId is at the tip of it's branch.
+ *
+ * @param repository
+ * @param commitId
+ * @return true if the given commit is the tip
+ */
+ public static boolean isTip(Repository repository, String commitId) {
+ try {
+ RefModel tip = getBranch(repository, commitId);
+ return (tip != null);
+ } catch (Exception e) {
+ LOGGER.error("Failed to determine isTip", e);
+ }
+ return false;
+ }
}