diff --git a/core/src/main/java/hudson/Functions.java b/core/src/main/java/hudson/Functions.java index 67be82b812..a94cd838fe 100644 --- a/core/src/main/java/hudson/Functions.java +++ b/core/src/main/java/hudson/Functions.java @@ -608,4 +608,14 @@ public class Functions { public static String getResourcePath() { return Hudson.RESOURCE_PATH; } + + /** + * Can be used to check a checkbox by default. + * Used from views like {@code h.defaultToTrue(scm.useUpdate)}. + * The expression will evaluate to true if scm is null. + */ + public static boolean defaultToTrue(Boolean b) { + if(b==null) return true; + return b; + } } diff --git a/core/src/main/resources/hudson/scm/CVSSCM/config.jelly b/core/src/main/resources/hudson/scm/CVSSCM/config.jelly index 222ed31428..0b01d0836a 100644 --- a/core/src/main/resources/hudson/scm/CVSSCM/config.jelly +++ b/core/src/main/resources/hudson/scm/CVSSCM/config.jelly @@ -16,7 +16,7 @@ - + diff --git a/core/src/main/resources/hudson/scm/SubversionSCM/config.jelly b/core/src/main/resources/hudson/scm/SubversionSCM/config.jelly index cc0e3c7952..68dd314d70 100644 --- a/core/src/main/resources/hudson/scm/SubversionSCM/config.jelly +++ b/core/src/main/resources/hudson/scm/SubversionSCM/config.jelly @@ -23,7 +23,7 @@ description=" If checked, Hudson will use 'svn update' whenever possible, making the build faster. But this causes the artifacts from the previous build to remain when a new build starts."> - +