Skip to content
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

Add support for --git-lfs on repo init #86

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
24 changes: 24 additions & 0 deletions src/main/java/hudson/plugins/repo/RepoScm.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ public class RepoScm extends SCM implements Serializable {
@CheckForNull private boolean noTags;
@CheckForNull private boolean manifestSubmodules;
@CheckForNull private boolean fetchSubmodules;
@CheckForNull private boolean gitLfs;
@CheckForNull private Set<String> ignoreProjects;
@CheckForNull private EnvVars extraEnvVars;
@CheckForNull private boolean noCloneBundle;
Expand Down Expand Up @@ -379,6 +380,13 @@ public boolean isFetchSubmodules() {
return fetchSubmodules;
}

/**
* Returns the value of gitLfs.
*/
public boolean isGitLfs() {
return gitLfs;
}

/**
* Returns the value of extraEnvVars.
*/
Expand Down Expand Up @@ -488,6 +496,7 @@ public RepoScm(final String manifestRepositoryUrl) {
noTags = false;
manifestSubmodules = false;
fetchSubmodules = false;
gitLfs = false;
ignoreProjects = Collections.<String>emptySet();
noCloneBundle = false;
worktree = false;
Expand Down Expand Up @@ -774,6 +783,18 @@ public void setFetchSubmodules(final boolean fetchSubmodules) {
this.fetchSubmodules = fetchSubmodules;
}

/**
* Set gitLfs.
*
* @param gitLfs
* If this value is true, add the "--git-lfs" option when
* executing "repo init".
*/
@DataBoundSetter
public void setGitLfs(final boolean gitLfs) {
this.gitLfs = gitLfs;
}

/**
* Sets list of projects which changes will be ignored when
* calculating whether job needs to be rebuild. This field corresponds
Expand Down Expand Up @@ -1060,6 +1081,9 @@ private boolean checkoutCode(final Launcher launcher,
commands.add("--trace");
}
commands.add("init");
if (isGitLfs()) {
commands.add("--git-lfs");
}
commands.add("-u");
commands.add(env.expand(manifestRepositoryUrl));
if (manifestBranch != null) {
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@
<f:checkbox default="false"/>
</f:entry>

<f:entry title="GIT large file storage" field="gitLfs">
<f:checkbox default="false"/>
</f:entry>

<f:entry title="Reset first" field="resetFirst">
<f:checkbox/>
</f:entry>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div>
<p>
Enable git lfs. This is passed to repo as repo init --git-lfs.
</p>
</div>