Skip to content

Commit d0d6022

Browse files
committed
chore(schemas): Update config schemas to reflect new sparse path handling and the use_git_default_sparse_checkout setting
1 parent eac9410 commit d0d6022

3 files changed

Lines changed: 92 additions & 3 deletions

File tree

schemas/submod.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
schemas/v1.1.0/submod_config_v1.1.0.json

schemas/v1.0.0/submod_config_v1.0.0.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"properties": {
1717
"ignore": { "$ref": "#/$defs/ignoreValue" },
1818
"update": { "$ref": "#/$defs/updateValue" },
19-
"fetch": { "$ref": "#/$defs/fetchValue" }
19+
"fetch": { "$ref": "#/$defs/fetchValue" },
20+
"use_git_default_sparse_checkout": { "$ref": "#/$defs/useGitDefaultSparseCheckoutValue" }
2021
},
2122
"additionalProperties": false
2223
}
@@ -43,6 +44,11 @@
4344
"default": "on-demand",
4445
"description": "When to fetch submodule updates from the remote.\n- \"on-demand\": fetch only when needed (default)\n- \"always\": fetch on every operation\n- \"never\": never fetch automatically\nhttps://docs.rs/submod/latest/submod/options/"
4546
},
47+
"useGitDefaultSparseCheckoutValue": {
48+
"type": "boolean",
49+
"default": false,
50+
"description": "If true, uses git's default sparse checkout behavior for the submodule. This means all files are included by default, and any specified sparse_paths are added to the checkout rather than replacing it. If false (the default), specifying sparse_paths replaces the default behavior and only the specified paths are included. We think our approach is more intuitive, but this option allows you to opt in to git's behavior if you prefer it or need it for compatibility reasons."
51+
},
4652
"submodule": {
4753
"type": "object",
4854
"description": "Configuration for a single submodule. The section name is your local alias for the submodule; submod maps it to the full relative path in .gitmodules and .git/config.",
@@ -63,7 +69,7 @@
6369
"sparse_paths": {
6470
"type": "array",
6571
"items": { "type": "string" },
66-
"description": "Relative paths or glob patterns to include in a sparse checkout. If omitted, all files are checked out.\nWhen set, git prepends:\n /*\n !/*/\nThis includes only root-level files by default. To include subdirectories, add paths like \"src/\". To exclude root files, prefix with \"!\" (e.g., \"!/README.md\")."
72+
"description": "Relative paths or glob patterns to include in a sparse checkout. By default, **no** paths are included when sparse_paths -- only those explicitly listed will be included. This is different from git's default sparse checkout behavior, which includes all files by default and adds specified paths to the checkout. We think our approach is more intuitive, but if you prefer git's behavior or need it for compatibility reasons, you can set use_git_default_sparse_checkout to true globally or for this submodule to have specified paths added to the default checkout rather than replacing it."
6773
},
6874
"shallow": {
6975
"type": "boolean",
@@ -72,7 +78,8 @@
7278
},
7379
"ignore": { "$ref": "#/$defs/ignoreValue" },
7480
"update": { "$ref": "#/$defs/updateValue" },
75-
"fetch": { "$ref": "#/$defs/fetchValue" }
81+
"fetch": { "$ref": "#/$defs/fetchValue" },
82+
"use_git_default_sparse_checkout": { "$ref": "#/$defs/useGitDefaultSparseCheckoutValue" }
7683
},
7784
"additionalProperties": false
7885
}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://raw.githubusercontent.com/bashandbone/submod/main/schemas/submod.json",
4+
"title": "submod configuration",
5+
"description": "Configuration file for submod, a git submodule management CLI.\nhttps://docs.rs/",
6+
"type": "object",
7+
"properties": {
8+
"schema_version": {
9+
"type": "string",
10+
"pattern": "^v?\\d+(\\.\\d+){0,2}$",
11+
"description": "The version of the submod configuration schema in use. Accepts \"1\", \"1.0\", or \"1.0.0\" format.\nhttps://docs.rs/submod"
12+
},
13+
"defaults": {
14+
"type": "object",
15+
"description": "Global defaults applied to all submodules. Git has no native global submodule configuration; submod resolves this by applying these settings across all submodule entries. Any settings you set for an individual submodule will override these defaults.\nhttps://docs.rs/submod/latest/submod/options/",
16+
"properties": {
17+
"ignore": { "$ref": "#/$defs/ignoreValue" },
18+
"update": { "$ref": "#/$defs/updateValue" },
19+
"fetch": { "$ref": "#/$defs/fetchValue" },
20+
""
21+
},
22+
"additionalProperties": false
23+
}
24+
},
25+
"additionalProperties": {
26+
"$ref": "#/$defs/submodule"
27+
},
28+
"$defs": {
29+
"ignoreValue": {
30+
"type": "string",
31+
"enum": ["all", "dirty", "untracked", "none"],
32+
"default": "none",
33+
"description": "Controls which changes cause a submodule to appear as modified in git status.\n- \"none\": report all changes (default)\n- \"untracked\": ignore untracked files\n- \"dirty\": ignore all working tree changes, only track commits\n- \"all\": always ignore the submodule\nhttps://docs.rs/submod/latest/submod/options/"
34+
},
35+
"updateValue": {
36+
"type": "string",
37+
"enum": ["checkout", "rebase", "merge", "none"],
38+
"default": "checkout",
39+
"description": "How to update the submodule when the superproject moves to a new commit.\n- \"checkout\": detach HEAD at the recorded commit (default)\n- \"rebase\": rebase current branch onto the recorded commit\n- \"merge\": merge the recorded commit into the current branch\n- \"none\": do not update\nhttps://docs.rs/submod/latest/submod/options/"
40+
},
41+
"fetchValue": {
42+
"type": "string",
43+
"enum": ["on-demand", "always", "never"],
44+
"default": "on-demand",
45+
"description": "When to fetch submodule updates from the remote.\n- \"on-demand\": fetch only when needed (default)\n- \"always\": fetch on every operation\n- \"never\": never fetch automatically\nhttps://docs.rs/submod/latest/submod/options/"
46+
},
47+
"submodule": {
48+
"type": "object",
49+
"description": "Configuration for a single submodule. The section name is your local alias for the submodule; submod maps it to the full relative path in .gitmodules and .git/config.",
50+
"required": ["url"],
51+
"properties": {
52+
"url": {
53+
"type": "string",
54+
"description": "Required. The submodule repository URL. Accepts remote URLs (https, ssh) or local paths (absolute or relative). Use the same value as in .gitmodules or .git/config."
55+
},
56+
"path": {
57+
"type": "string",
58+
"description": "Path where the submodule is checked out, relative to the superproject root. Defaults to the submodule name in the repository root."
59+
},
60+
"branch": {
61+
"type": "string",
62+
"description": "Branch to track in the submodule. Defaults to the submodule's default branch (usually main or master).\nUse \".\" or the aliases \"current\", \"current-in-superproject\", \"superproject\", or \"super\" to track the superproject's current branch. **Do not use these strings as actual branch names in the submodule repository.** If you need to track a branch with one of these names, use the full branch name (e.g., \"refs/heads/current\")."
63+
},
64+
"sparse_paths": {
65+
"type": "array",
66+
"items": { "type": "string" },
67+
"description": "Relative paths or glob patterns to include in a sparse checkout. If omitted, all files are checked out.\nWhen set, git prepends:\n /*\n !/*/\nThis includes only root-level files by default. To include subdirectories, add paths like \"src/\". To exclude root files, prefix with \"!\" (e.g., \"!/README.md\")."
68+
},
69+
"shallow": {
70+
"type": "boolean",
71+
"default": false,
72+
"description": "If true, performs a shallow clone (only the most recent commit). Useful for large repositories where full history is not needed."
73+
},
74+
"ignore": { "$ref": "#/$defs/ignoreValue" },
75+
"update": { "$ref": "#/$defs/updateValue" },
76+
"fetch": { "$ref": "#/$defs/fetchValue" }
77+
},
78+
"additionalProperties": false
79+
}
80+
}
81+
}

0 commit comments

Comments
 (0)