summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorDave Borowitz2011-12-08 11:00:39 (EST)
committer Dave Borowitz2011-12-08 11:26:08 (EST)
commitd6172dc0de2cbaeb0bd38a9d30278dd5f9b140b3 (patch)
treeca46f9ac8a96967a974358048df309586b64a353
parentcd958ba93cd62399da3efdd13eb9ccaa0512a452 (diff)
downloadjgit-d6172dc0de2cbaeb0bd38a9d30278dd5f9b140b3.zip
jgit-d6172dc0de2cbaeb0bd38a9d30278dd5f9b140b3.tar.gz
jgit-d6172dc0de2cbaeb0bd38a9d30278dd5f9b140b3.tar.bz2
Add a no-op UploadPackLogger and use it by defaultrefs/changes/68/4768/2
This matches the behavior of the hooks in UploadPack. Change-Id: I21277e52ee9452237d87084f06bb140dfa6bf608
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java9
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPackLogger.java7
2 files changed, 14 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
index ca3d247..2fa6e5c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
@@ -217,7 +217,7 @@ public class UploadPack {
private PackWriter.Statistics statistics;
- private UploadPackLogger logger;
+ private UploadPackLogger logger = UploadPackLogger.NULL;
/**
* Create a new pack upload for an open repository.
@@ -376,6 +376,11 @@ public class UploadPack {
this.packConfig = pc;
}
+ /** @return the configured logger. */
+ public UploadPackLogger getLogger() {
+ return logger;
+ }
+
/**
* Set the logger.
*
@@ -1111,7 +1116,7 @@ public class UploadPack {
if (sideband)
pckOut.end();
- if (logger != null && statistics != null)
+ if (statistics != null)
logger.onPackStatistics(statistics);
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPackLogger.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPackLogger.java
index 6e37b83..45f91ed 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPackLogger.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPackLogger.java
@@ -54,6 +54,13 @@ import org.eclipse.jgit.storage.pack.PackWriter;
* the connection information before invoking UploadPack.
*/
public interface UploadPackLogger {
+ /** A simple no-op logger. */
+ public static final UploadPackLogger NULL = new UploadPackLogger() {
+ public void onPackStatistics(PackWriter.Statistics stats) {
+ // Do nothing.
+ }
+ };
+
/**
* Notice to the logger after a pack has been sent.
*