Skip to content

Commit f14b7e3

Browse files
committed
Rename sparse-pattern commands to be more concise
1 parent f20e649 commit f14b7e3

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

git-partial-submodule.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
1717

18+
# For more information, see https://github.com/Reedbeta/git-partial-submodule
19+
1820
# Check Python version
1921
import sys
2022
if sys.hexversion < 0x03080000:
@@ -24,7 +26,7 @@
2426

2527
# Parse arguments
2628

27-
parser = argparse.ArgumentParser(description="Add or clone partial git submodules.")
29+
parser = argparse.ArgumentParser(description="Add or clone partial git submodules; save and restore sparse-checkout patterns.")
2830
parser.add_argument('-n', '--dry-run', dest='dryRun', default=False, action='store_true', help='Dry run (display git commands without executing them)')
2931
parser.add_argument('-v', '--verbose', dest='verbose', default=False, action='store_true', help='Verbose (display git commands being run, and other info)')
3032
subparsers = parser.add_subparsers(dest='command', metavar='command')
@@ -43,15 +45,15 @@
4345
help = "Clone partial submodules from .gitmodules.")
4446
cloneCmdParser.add_argument('paths', nargs='*', default=[], help='Submodule path(s) to clone (if unspecified, all submodules)')
4547

46-
saveSparsePatternsCmdParser = subparsers.add_parser(
47-
'save-sparse-patterns',
48+
saveSparseCmdParser = subparsers.add_parser(
49+
'save-sparse',
4850
help = "Save sparse-checkout patterns to .gitmodules.")
49-
saveSparsePatternsCmdParser.add_argument('paths', nargs='*', default=[], help='Submodule path(s) to save (if unspecified, all submodules)')
51+
saveSparseCmdParser.add_argument('paths', nargs='*', default=[], help='Submodule path(s) to save (if unspecified, all submodules)')
5052

51-
reapplySparsePatternsCmdParser = subparsers.add_parser(
52-
'reapply-sparse-patterns',
53-
help = "Re-apply sparse-checkout patterns from .gitmodules.")
54-
reapplySparsePatternsCmdParser.add_argument('paths', nargs='*', default=[], help='Submodule path(s) to reapply (if unspecified, all submodules)')
53+
restoreSparseCmdParser = subparsers.add_parser(
54+
'restore-sparse',
55+
help = "Restore sparse-checkout patterns from .gitmodules.")
56+
restoreSparseCmdParser.add_argument('paths', nargs='*', default=[], help='Submodule path(s) to restore (if unspecified, all submodules)')
5557

5658
args = parser.parse_args()
5759

@@ -268,7 +270,7 @@ def ReadGitmodules(worktreeRoot):
268270
(len(submoduleRelPathsToProcess) - submodulesSkipped,
269271
submodulesSkipped))
270272

271-
elif args.command == 'save-sparse-patterns':
273+
elif args.command == 'save-sparse':
272274
# Load .gitmodules information
273275
gitmodules = ReadGitmodules(worktreeRoot)
274276

@@ -310,7 +312,7 @@ def ReadGitmodules(worktreeRoot):
310312
okReturnCodes=[0, 5]) # code 5 = "you try to unset an option which does not exist"
311313
print("Sparse checkout not enabled for %s." % submodule['name'])
312314

313-
elif args.command == 'reapply-sparse-patterns':
315+
elif args.command == 'restore-sparse':
314316
# Load .gitmodules information
315317
gitmodules = ReadGitmodules(worktreeRoot)
316318

0 commit comments

Comments
 (0)