summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.lfs
diff options
context:
space:
mode:
authorTim Neumann <Tim.Neumann@advantest.com>2019-11-28 15:56:50 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2019-12-09 00:56:40 +0100
commit23125abc20758f06aae9877306ceca6651750b3c (patch)
treed5f8998ee61b8c8e828d007b3c4b7747c0b2ea97 /org.eclipse.jgit.lfs
parentd1bdfcd0a85d1092aee0230b282bba577c73fb4d (diff)
downloadjgit-23125abc20758f06aae9877306ceca6651750b3c.tar.gz
jgit-23125abc20758f06aae9877306ceca6651750b3c.zip
Add ability to redirect stderr from git hooks
This will change the behavior in the CLI to resemble that of C-Git more closely by printing the stderr of the hooks to the CLI stderr independently of the exit code of the hook. This is also useful for the corresponding EGIT-Change, which will add the ability to show the hook output in eclipse. With this also the stderr can be shown even if the exit code is 0. Bug: 553471 Change-Id: Ie7bc503fe39e270e9b93dd1108b5879f02a12b4c Signed-off-by: Tim Neumann <Tim.Neumann@advantest.com>
Diffstat (limited to 'org.eclipse.jgit.lfs')
-rw-r--r--org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/BuiltinLFS.java10
-rw-r--r--org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPrePushHook.java14
2 files changed, 24 insertions, 0 deletions
diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/BuiltinLFS.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/BuiltinLFS.java
index 3c5826362c..e90d92976a 100644
--- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/BuiltinLFS.java
+++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/BuiltinLFS.java
@@ -106,6 +106,16 @@ public class BuiltinLFS extends LfsFactory {
return null;
}
+ @Override
+ @Nullable
+ public PrePushHook getPrePushHook(Repository repo, PrintStream outputStream,
+ PrintStream errorStream) {
+ if (isEnabled(repo)) {
+ return new LfsPrePushHook(repo, outputStream, errorStream);
+ }
+ return null;
+ }
+
/**
* @param db
* the repository
diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPrePushHook.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPrePushHook.java
index 3e6a26159b..b3e304fea2 100644
--- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPrePushHook.java
+++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPrePushHook.java
@@ -107,6 +107,20 @@ public class LfsPrePushHook extends PrePushHook {
super(repo, outputStream);
}
+ /**
+ * @param repo
+ * the repository
+ * @param outputStream
+ * not used by this implementation
+ * @param errorStream
+ * not used by this implementation
+ * @since 5.6
+ */
+ public LfsPrePushHook(Repository repo, PrintStream outputStream,
+ PrintStream errorStream) {
+ super(repo, outputStream, errorStream);
+ }
+
@Override
public void setRefs(Collection<RemoteRefUpdate> toRefs) {
this.refs = toRefs;