From 6ecf3907a012f5c12c6801f0d2ffe8b4e440c209 Mon Sep 17 00:00:00 2001
From: Paul Martin <paul@paulsputer.com>
Date: Tue, 05 Apr 2016 13:48:07 -0400
Subject: [PATCH] Merge pull request #1040 from gitblit/1037-EnforcePermissionsForTickets
---
src/main/java/com/gitblit/utils/JGitUtils.java | 17 +++++++++++++++++
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 3aaad6d..90d4002 100644
--- a/src/main/java/com/gitblit/utils/JGitUtils.java
+++ b/src/main/java/com/gitblit/utils/JGitUtils.java
@@ -2727,5 +2727,22 @@
}
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;
+ }
}
--
Gitblit v1.9.1