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

Support syncing repositories that utilize Git LFS #88

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 @@ -132,6 +132,7 @@ public class RepoScm extends SCM implements Serializable {
@CheckForNull private EnvVars extraEnvVars;
@CheckForNull private boolean noCloneBundle;
@CheckForNull private boolean worktree;
@CheckForNull private boolean gitLfs;

/**
* Returns the manifest repository URL.
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 @@ -491,6 +499,7 @@ public RepoScm(final String manifestRepositoryUrl) {
ignoreProjects = Collections.<String>emptySet();
noCloneBundle = false;
worktree = false;
gitLfs = 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 @@ -1106,6 +1127,9 @@ private boolean checkoutCode(final Launcher launcher,
if (manifestSubmodules) {
commands.add("--submodules");
}
if (gitLfs) {
commands.add("--git-lfs");
}
int returnCode =
launcher.launch().stdout(logger).pwd(workspace)
.cmds(commands).envs(env).join();
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 @@ -109,5 +109,9 @@
<f:checkbox/>
</f:entry>

<f:entry title="Git LFS" field="gitLfs">
<f:checkbox default="false"/>
</f:entry>

</f:advanced>
</j:jelly>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div>
<p>
Allow repositories utilizing LFS to sync LFS objects.
This is passed to repo as <code>repo init <i>--git-lfs</i></code>.
</p>
</div>
Loading