-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[JENKINS-42971] GitSCMFileSystem consumes environment and expands branch name #1305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
cc02c2f
a69a857
27aa68e
b04e8f7
d7159dc
6111ed5
5f84f6b
2b17a1c
ac7e38c
c678a26
0fad6ba
33d96e0
c61fbc4
b05d4ce
99eb6a2
5e77775
686cc2a
54af228
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -35,6 +35,7 @@ | |||||
| import hudson.EnvVars; | ||||||
| import hudson.Extension; | ||||||
| import hudson.model.Item; | ||||||
| import hudson.model.Run; | ||||||
| import hudson.model.TaskListener; | ||||||
| import hudson.plugins.git.BranchSpec; | ||||||
| import hudson.plugins.git.GitException; | ||||||
|
|
@@ -283,15 +284,66 @@ public boolean supportsDescriptor(SCMSourceDescriptor descriptor) { | |||||
| return AbstractGitSCMSource.class.isAssignableFrom(descriptor.clazz); | ||||||
| } | ||||||
|
|
||||||
| public static class HeadNameResult | ||||||
|
||||||
| public static class HeadNameResult | |
| static class HeadNameResult |
Not used outside this class and the test, right?
(In which case you could also simplify a bit by dropping private from the fields and removing the getters—this is just an internal struct, no need for accessors.)
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stylistically I would recommend
| public HeadNameResult(String headName, String prefix) { | |
| private HeadNameResult(String headName, String prefix) { |
and then moving calculateHeadName inside this nested class, and renaming it accordingly (to simply calculate, or create, or make, or of, etc.).
MartinKosicky marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
MartinKosicky marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
MartinKosicky marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
MartinKosicky marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -43,6 +43,8 @@ | |||||||
| import jenkins.scm.api.SCMRevision; | ||||||||
| import jenkins.scm.api.SCMSource; | ||||||||
| import jenkins.scm.api.SCMSourceDescriptor; | ||||||||
|
|
||||||||
| import org.eclipse.jgit.lib.Constants; | ||||||||
| import org.eclipse.jgit.lib.ObjectId; | ||||||||
| import org.jenkinsci.plugins.gitclient.Git; | ||||||||
| import org.jenkinsci.plugins.gitclient.GitClient; | ||||||||
|
|
@@ -427,6 +429,43 @@ public void filesystem_supports_descriptor() throws Exception { | |||||||
| assertTrue(SCMFileSystem.supports(descriptor)); | ||||||||
| } | ||||||||
|
|
||||||||
| @Issue("JENKINS-42971") | ||||||||
| @Test | ||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. May also want to assert behavior with a null env, undefined variable, etc.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there is one for null env, but this is internal method, and there are many checks already in the calling method |
||||||||
| public void calculate_head_name_with_env() throws Exception | ||||||||
| { | ||||||||
|
||||||||
| public void calculate_head_name_with_env() throws Exception | |
| { | |
| public void calculate_head_name_with_env() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update
git-plugin/pom.xml
Line 78 in d7159dc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok i updated it, I hope correctly