Browse Source

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 <matthias.sohn@sap.com>
tags/v4.2.0.201601211800-r
Matthias Sohn 8 years ago
parent
commit
d3e61db455
1 changed files with 3 additions and 0 deletions
  1. 3
    0
      org.eclipse.jgit/src/org/eclipse/jgit/hooks/PrePushHook.java

+ 3
- 0
org.eclipse.jgit/src/org/eclipse/jgit/hooks/PrePushHook.java View File

@@ -113,6 +113,9 @@ public class PrePushHook extends GitHook<String> {
*/
@Override
protected String[] getParameters() {
if (remoteName == null) {
remoteName = remoteLocation;
}
return new String[] { remoteName, remoteLocation };
}


Loading…
Cancel
Save