This commit is contained in:
@@ -89,10 +89,14 @@ public class GithubValueParsers {
|
||||
for (String expectedPrefix : GithubRepoContentAssistant.URI_PREFIXES) {
|
||||
int lastChar = expectedPrefix.length()-1;
|
||||
if (str.startsWith(expectedPrefix.substring(0, lastChar))) {
|
||||
if (str.charAt(lastChar)==expectedPrefix.charAt(lastChar)) {
|
||||
char actualSeparator = str.charAt(lastChar);
|
||||
char expectedSeparator = expectedPrefix.charAt(lastChar);
|
||||
if (actualSeparator==expectedSeparator) {
|
||||
return expectedPrefix;
|
||||
}
|
||||
throw new ValueParseException("Expecting a '"+expectedPrefix.charAt(lastChar)+"'", lastChar, lastChar+1);
|
||||
if (actualSeparator==':' || actualSeparator == '/') {
|
||||
throw new ValueParseException("Expecting a '"+expectedSeparator+"'", lastChar, lastChar+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -4752,6 +4752,31 @@ public class ConcourseEditorTest {
|
||||
);
|
||||
}
|
||||
|
||||
@Test public void githubUriReconciling_bug_194() throws Exception {
|
||||
//See: https://github.com/spring-projects/sts4/issues/194
|
||||
|
||||
Editor editor;
|
||||
|
||||
editor = harness.newEditor(
|
||||
"resources:\n" +
|
||||
"- name: my-repo\n" +
|
||||
" type: git\n" +
|
||||
" source:\n" +
|
||||
" uri: git@github.computer.com:me/repo.git\n"
|
||||
);
|
||||
editor.assertProblems("my-repo|Unused");
|
||||
|
||||
editor = harness.newEditor(
|
||||
"resources:\n" +
|
||||
"- name: my-repo\n" +
|
||||
" type: git\n" +
|
||||
" source:\n" +
|
||||
" uri: https://github.computer.com/me/repo.git\n"
|
||||
);
|
||||
editor.assertProblems("my-repo|Unused");
|
||||
|
||||
}
|
||||
|
||||
@Test public void githubUriReconciling() throws Exception {
|
||||
when(github.getReposForOwner("the-owner")).thenReturn(ImmutableList.of(
|
||||
"nice-repo", "cool-project", "good-stuff"
|
||||
|
||||
Reference in New Issue
Block a user