Skip to content

Commit

Permalink
Support syncing repositories that utilize Git LFS
Browse files Browse the repository at this point in the history
The primary usecase of repo is AOSP development, however objects in
AOSP can often get quite large, a lot of firmware and proprietary blobs
can be well above 100 MiB which is the GitHub limit.
  • Loading branch information
AKoskovich committed Dec 16, 2023
1 parent 30fe94b commit 6532a01
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
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 isLfs.
*/
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>

0 comments on commit 6532a01

Please sign in to comment.