summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/gitblit/git
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2013-07-16 09:35:31 -0400
committerJames Moger <james.moger@gitblit.com>2013-07-16 09:35:31 -0400
commitf01bc58183dca2378ffe931315396583d053c6be (patch)
treef7be4abdf4d3116890e144ff350195b12e92a173 /src/main/java/com/gitblit/git
parentf10286ce6371624fb49486202f14d3f75f866cc4 (diff)
downloadgitblit-f01bc58183dca2378ffe931315396583d053c6be.tar.gz
gitblit-f01bc58183dca2378ffe931315396583d053c6be.zip
Reset dashboard and activity commit cache on branch REWIND or DELETE
Diffstat (limited to 'src/main/java/com/gitblit/git')
-rw-r--r--src/main/java/com/gitblit/git/ReceiveHook.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/main/java/com/gitblit/git/ReceiveHook.java b/src/main/java/com/gitblit/git/ReceiveHook.java
index e0b77987..d75a2385 100644
--- a/src/main/java/com/gitblit/git/ReceiveHook.java
+++ b/src/main/java/com/gitblit/git/ReceiveHook.java
@@ -36,6 +36,7 @@ import org.eclipse.jgit.transport.ReceivePack;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.gitblit.Constants;
import com.gitblit.Constants.AccessRestrictionType;
import com.gitblit.GitBlit;
import com.gitblit.Keys;
@@ -44,6 +45,7 @@ import com.gitblit.models.RepositoryModel;
import com.gitblit.models.UserModel;
import com.gitblit.utils.ArrayUtils;
import com.gitblit.utils.ClientLogger;
+import com.gitblit.utils.CommitCache;
import com.gitblit.utils.JGitUtils;
import com.gitblit.utils.RefLogUtils;
import com.gitblit.utils.StringUtils;
@@ -186,6 +188,21 @@ public class ReceiveHook implements PreReceiveHook, PostReceiveHook {
return;
}
}
+
+ // reset branch commit cache on REWIND and DELETE
+ for (ReceiveCommand cmd : commands) {
+ String ref = cmd.getRefName();
+ if (ref.startsWith(Constants.R_HEADS)) {
+ switch (cmd.getType()) {
+ case UPDATE_NONFASTFORWARD:
+ case DELETE:
+ CommitCache.instance().clear(repository.name, ref);
+ break;
+ default:
+ break;
+ }
+ }
+ }
Set<String> scripts = new LinkedHashSet<String>();
scripts.addAll(GitBlit.self().getPreReceiveScriptsInherited(repository));