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

Ask git to checkout a submodule even if it is skipped in .gitmodules #2086

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
Ask git to checkout a submodule even if it is skipped in .gitmodules
Setting a submodule as `update = none` is a common way to make cargo
skip the submodule. Unfortunately this makes `actions/checkout` skip
the submodule too, even if it's configured to fetch submodules.

This patch adds an option that is a default in git but causes the
submodules to be available even if skipped otherwise.

See: #915
See: rust-lang/cargo#4247 (comment)
See: https://git-scm.com/docs/git-submodule#Documentation/git-submodule.txt---checkout
  • Loading branch information
wiktor-k committed Feb 18, 2025
commit 38cd156730b4cb5dbcab5f29df2435aa38e06811
2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
@@ -796,7 +796,7 @@ class GitCommandManager {
submoduleUpdate(fetchDepth, recursive) {
return __awaiter(this, void 0, void 0, function* () {
const args = ['-c', 'protocol.version=2'];
args.push('submodule', 'update', '--init', '--force');
args.push('submodule', 'update', '--init', '--force', '--checkout');
if (fetchDepth > 0) {
args.push(`--depth=${fetchDepth}`);
}
2 changes: 1 addition & 1 deletion src/git-command-manager.ts
Original file line number Diff line number Diff line change
@@ -411,7 +411,7 @@ class GitCommandManager {

async submoduleUpdate(fetchDepth: number, recursive: boolean): Promise<void> {
const args = ['-c', 'protocol.version=2']
args.push('submodule', 'update', '--init', '--force')
args.push('submodule', 'update', '--init', '--force', '--checkout')
if (fetchDepth > 0) {
args.push(`--depth=${fetchDepth}`)
}