From d3e61db455174ce8af70fcc80a19f414881dfea9 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Tue, 17 Nov 2015 17:26:53 +0100 Subject: [PATCH] Fix pre-push hook to not set null remoteName as first argument According to [1] the pre-push hook expects two parameters which provide the name and location of the destination remote, if a named remote is not being used both values should be the same. We did set the first parameter to null in that case which caused ProcessBuilder to throw a NullPointerException since its start() method doesn't accept null arguments. [1] https://git-scm.com/docs/githooks#_pre_push Bug: 482393 Change-Id: Idb9b0a48cefac01abfcfdf00f6d173f8fa1d9a7b Signed-off-by: Matthias Sohn --- org.eclipse.jgit/src/org/eclipse/jgit/hooks/PrePushHook.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/hooks/PrePushHook.java b/org.eclipse.jgit/src/org/eclipse/jgit/hooks/PrePushHook.java index 2e6582819..a501fee90 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/hooks/PrePushHook.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/hooks/PrePushHook.java @@ -113,6 +113,9 @@ public class PrePushHook extends GitHook { */ @Override protected String[] getParameters() { + if (remoteName == null) { + remoteName = remoteLocation; + } return new String[] { remoteName, remoteLocation }; }