diff options
-rw-r--r-- | releases.moxie | 1 | ||||
-rw-r--r-- | src/main/java/com/gitblit/git/GitblitReceivePack.java | 8 | ||||
-rw-r--r-- | src/main/java/com/gitblit/manager/GitblitManager.java | 5 | ||||
-rw-r--r-- | src/main/java/com/gitblit/manager/IRepositoryManager.java | 8 | ||||
-rw-r--r-- | src/main/java/com/gitblit/manager/RepositoryManager.java | 12 |
5 files changed, 34 insertions, 0 deletions
diff --git a/releases.moxie b/releases.moxie index 6866b403..8aafab17 100644 --- a/releases.moxie +++ b/releases.moxie @@ -16,6 +16,7 @@ r23: { - Fix forcing default locale to en or LANG_CC for web ui (ticket-51) - Fix inconsistency with repository ownership permission checking (ticket-52) - Prevent submission from New|Edit ticket page with empty titles (ticket-53) + - Ensure the repository model ref list is refreshed on ref creation or deletion (ticket-54) - Fix case-sensitivity error in determining fork network (issue-420, ticket-62) - Fix transport determination for SSH urls served on port 22 (issue-421, ticket-63) changes: diff --git a/src/main/java/com/gitblit/git/GitblitReceivePack.java b/src/main/java/com/gitblit/git/GitblitReceivePack.java index 61f2d67d..b4449f06 100644 --- a/src/main/java/com/gitblit/git/GitblitReceivePack.java +++ b/src/main/java/com/gitblit/git/GitblitReceivePack.java @@ -331,6 +331,8 @@ public class GitblitReceivePack extends ReceivePack implements PreReceiveHook, P return;
}
+ boolean isRefCreationOrDeletion = false;
+
// log ref changes
for (ReceiveCommand cmd : commands) {
@@ -339,9 +341,11 @@ public class GitblitReceivePack extends ReceivePack implements PreReceiveHook, P switch (cmd.getType()) {
case DELETE:
LOGGER.info(MessageFormat.format("{0} DELETED {1} in {2} ({3})", user.username, cmd.getRefName(), repository.name, cmd.getOldId().name()));
+ isRefCreationOrDeletion = true;
break;
case CREATE:
LOGGER.info(MessageFormat.format("{0} CREATED {1} in {2}", user.username, cmd.getRefName(), repository.name));
+ isRefCreationOrDeletion = true;
break;
case UPDATE:
LOGGER.info(MessageFormat.format("{0} UPDATED {1} in {2} (from {3} to {4})", user.username, cmd.getRefName(), repository.name, cmd.getOldId().name(), cmd.getNewId().name()));
@@ -355,6 +359,10 @@ public class GitblitReceivePack extends ReceivePack implements PreReceiveHook, P }
}
+ if (isRefCreationOrDeletion) {
+ gitblit.resetRepositoryCache(repository.name);
+ }
+
if (repository.useIncrementalPushTags) {
// tag each pushed branch tip
String emailAddress = user.emailAddress == null ? rp.getRefLogIdent().getEmailAddress() : user.emailAddress;
diff --git a/src/main/java/com/gitblit/manager/GitblitManager.java b/src/main/java/com/gitblit/manager/GitblitManager.java index 5b16ef66..2782e724 100644 --- a/src/main/java/com/gitblit/manager/GitblitManager.java +++ b/src/main/java/com/gitblit/manager/GitblitManager.java @@ -929,6 +929,11 @@ public class GitblitManager implements IGitblit { } @Override + public void resetRepositoryCache(String repositoryName) { + repositoryManager.resetRepositoryCache(repositoryName); + } + + @Override public List<String> getRepositoryList() { return repositoryManager.getRepositoryList(); } diff --git a/src/main/java/com/gitblit/manager/IRepositoryManager.java b/src/main/java/com/gitblit/manager/IRepositoryManager.java index fd5fc14b..69177f1e 100644 --- a/src/main/java/com/gitblit/manager/IRepositoryManager.java +++ b/src/main/java/com/gitblit/manager/IRepositoryManager.java @@ -159,6 +159,14 @@ public interface IRepositoryManager extends IManager { void resetRepositoryListCache(); /** + * Reset all caches for this repository. + * + * @param repositoryName + * @since 1.5.1 + */ + void resetRepositoryCache(String repositoryName); + + /** * Returns the list of all repositories available to Gitblit. This method * does not consider user access permissions. * diff --git a/src/main/java/com/gitblit/manager/RepositoryManager.java b/src/main/java/com/gitblit/manager/RepositoryManager.java index a76787bb..7351eb97 100644 --- a/src/main/java/com/gitblit/manager/RepositoryManager.java +++ b/src/main/java/com/gitblit/manager/RepositoryManager.java @@ -455,6 +455,18 @@ public class RepositoryManager implements IRepositoryManager { } /** + * Reset all caches for this repository. + * + * @param repositoryName + * @since 1.5.1 + */ + @Override + public void resetRepositoryCache(String repositoryName) { + removeFromCachedRepositoryList(repositoryName); + clearRepositoryMetadataCache(repositoryName); + } + + /** * Resets the repository list cache. * */ |