Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,16 @@
import hudson.plugins.git.Revision;
import hudson.util.ArgumentListBuilder;
import hudson.util.Secret;
import java.io.*;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.StringReader;
import java.io.StringWriter;
import java.io.Writer;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.charset.Charset;
Expand Down Expand Up @@ -612,7 +621,7 @@ public void execute() throws GitException, InterruptedException {
if (refspecs != null) {
for (RefSpec rs : refspecs) {
if (rs != null) {
args.add(rs.toString());
args.add(rs.toString().trim());
}
}
}
Expand Down Expand Up @@ -667,7 +676,7 @@ public void fetch(String remoteName, RefSpec... refspec) throws GitException, In
if (refspec != null && refspec.length > 0) {
for (RefSpec rs : refspec) {
if (rs != null) {
args.add(rs.toString());
args.add(rs.toString().trim());
}
}
}
Expand Down Expand Up @@ -861,7 +870,8 @@ public void execute() throws GitException, InterruptedException {
}

if (refspecs == null) {
refspecs = Collections.singletonList(new RefSpec("+refs/heads/*:refs/remotes/" + origin + "/*"));
refspecs = Collections.singletonList(
new RefSpec("+refs/heads/*:refs/remotes/" + origin + "/*".trim()));
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this hard-coded we can remove trim(). I was not sure if I should.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The existing trim should be removed. It won't change the RefSpec definition in any way because "/*".trim() is the same as "/*"

}
fetch_().from(urIish, refspecs)
.shallow(shallow)
Expand Down