Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FIXED JENKINS-11460] "Repository URL" field in mercurial plugin shou…
…ld trim input
  • Loading branch information
davidmc24 committed Oct 28, 2011
1 parent 36e5efe commit 3ffdb3e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/hudson/plugins/mercurial/MercurialSCM.java
Expand Up @@ -95,7 +95,7 @@ public class MercurialSCM extends SCM implements Serializable {
@DataBoundConstructor
public MercurialSCM(String installation, String source, String branch, String modules, String subdir, HgBrowser browser, boolean clean) {
this.installation = installation;
this.source = source;
this.source = Util.fixEmptyAndTrim(source);
this.modules = Util.fixNull(modules);
this.subdir = Util.fixEmptyAndTrim(subdir);
this.clean = clean;
Expand Down
12 changes: 12 additions & 0 deletions src/test/java/hudson/plugins/mercurial/MercurialSCMTest.java
Expand Up @@ -6,6 +6,7 @@
import hudson.model.AbstractBuild;
import hudson.model.FreeStyleProject;
import hudson.model.ParametersAction;
import hudson.model.Result;
import hudson.model.StringParameterValue;
import hudson.scm.ChangeLogSet;
import hudson.scm.ChangeLogSet.Entry;
Expand Down Expand Up @@ -423,6 +424,17 @@ public void testPolling() throws Exception {
pr = pollSCMChanges(p);
assertPollingResult(PollingResult.Change.SIGNIFICANT, cs4, cs5, pr);
}

@Bug(11460)
public void testTrailingUrlWhitespace() throws Exception {
FreeStyleProject p = createFreeStyleProject();
p.setScm(new MercurialSCM(hgInstallation, repo.getPath() + " ", null,
null, null, null, false));
hg(repo, "init");
touchAndCommit(repo, "dir1/f1");
AbstractBuild<?, ?> b = p.scheduleBuild2(0).get();
assertEquals(Result.SUCCESS, b.getResult());
}

private PretendSlave createNoopPretendSlave() throws Exception {
return createPretendSlave(new NoopFakeLauncher());
Expand Down

0 comments on commit 3ffdb3e

Please sign in to comment.