From 4fcac9d2cbdafb51e3ee9ca3b3da64fd86103174 Mon Sep 17 00:00:00 2001 From: James Moger <james.moger@gitblit.com> Date: Tue, 26 Nov 2013 15:58:15 -0500 Subject: [PATCH] Remove artifact setting from manager dialog --- src/main/java/com/gitblit/git/GitblitReceivePack.java | 24 ++++++++++++++++++++---- 1 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/gitblit/git/GitblitReceivePack.java b/src/main/java/com/gitblit/git/GitblitReceivePack.java index 2d648bd..ba200b2 100644 --- a/src/main/java/com/gitblit/git/GitblitReceivePack.java +++ b/src/main/java/com/gitblit/git/GitblitReceivePack.java @@ -106,7 +106,7 @@ setAllowCreates(user.canCreateRef(repository)); setAllowDeletes(user.canDeleteRef(repository)); setAllowNonFastForwards(user.canRewindRef(repository)); - + // setup pre and post receive hook setPreReceiveHook(this); setPostReceiveHook(this); @@ -119,6 +119,14 @@ */ @Override public void onPreReceive(ReceivePack rp, Collection<ReceiveCommand> commands) { + + if (repository.isMirror) { + // repository is a mirror + for (ReceiveCommand cmd : commands) { + sendRejection(cmd, "Gitblit does not allow pushes to \"{0}\" because it is a mirror!", repository.name); + } + return; + } if (repository.isFrozen) { // repository is frozen/readonly @@ -389,14 +397,22 @@ LOGGER.error(text + " (" + user.username + ")"); } + protected void sendHeader(String msg, Object... objects) { + sendMessage("--->", msg, objects); + } + protected void sendMessage(String msg, Object... objects) { + sendMessage(" ", msg, objects); + } + + protected void sendMessage(String prefix, String msg, Object... objects) { String text; if (ArrayUtils.isEmpty(objects)) { text = msg; - super.sendMessage(msg); + super.sendMessage(prefix + msg); } else { text = MessageFormat.format(msg, objects); - super.sendMessage(text); + super.sendMessage(prefix + text); } LOGGER.info(text + " (" + user.username + ")"); } @@ -421,7 +437,7 @@ * @param commands * @param scripts */ - protected void runGroovy(Collection<ReceiveCommand> commands, Set<String> scripts) { + private void runGroovy(Collection<ReceiveCommand> commands, Set<String> scripts) { if (scripts == null || scripts.size() == 0) { // no Groovy scripts to execute return; -- Gitblit v1.9.1