@@ -374,12 +374,12 @@ def is_local_git_repo_dirty(git_url):
374374 return repo .is_dirty (untracked_files = True )
375375
376376
377- def check_local_git_repo (git_url ):
377+ def check_local_git_repo (git_url , allow_dirty ):
378378 if is_local_git_repo_url (git_url ):
379379 if not is_local_git_repo (git_url ):
380380 print_error (f"error: path { git_url } is not a git repository" )
381381 return False
382- if is_local_git_repo_dirty (git_url ):
382+ if not allow_dirty and is_local_git_repo_dirty (git_url ):
383383 print_error (f"error: local git clone at { git_url } is dirty" )
384384 return False
385385
@@ -549,7 +549,7 @@ def cmd_test(manager, args, config, configfile):
549549 package_infos = []
550550
551551 for name in args .package :
552- if not check_local_git_repo (name ):
552+ if not check_local_git_repo (name , args . ignore_dirty_git ):
553553 sys .exit (1 )
554554
555555 version = args .version if args .version else active_git_branch (name )
@@ -619,7 +619,7 @@ def cmd_install(manager, args, config, configfile):
619619 package_infos = []
620620
621621 for name in args .package :
622- if not check_local_git_repo (name ):
622+ if not check_local_git_repo (name , args . ignore_dirty_git ):
623623 sys .exit (1 )
624624
625625 version = args .version if args .version else active_git_branch (name )
@@ -889,7 +889,7 @@ def cmd_bundle(manager, args, config, configfile):
889889 new_pkgs = []
890890
891891 for name , version in packages :
892- if not check_local_git_repo (name ):
892+ if not check_local_git_repo (name , args . ignore_dirty_git ):
893893 sys .exit (1 )
894894
895895 if not version :
@@ -2471,6 +2471,13 @@ def argparser():
24712471 " the latest version tag, or if a package has none,"
24722472 ' the default branch, like "main" or "master".' ,
24732473 )
2474+ sub_parser .add_argument (
2475+ "--ignore-dirty-git" ,
2476+ action = "store_true" ,
2477+ help = (
2478+ "Allows installation of packages from 'dirty' git clones instead of failing."
2479+ ),
2480+ )
24742481
24752482 # install
24762483 sub_parser = command_parser .add_parser (
@@ -2512,6 +2519,13 @@ def argparser():
25122519 " the latest version tag, or if a package has none,"
25132520 ' the default branch, like "main" or "master".' ,
25142521 )
2522+ sub_parser .add_argument (
2523+ "--ignore-dirty-git" ,
2524+ action = "store_true" ,
2525+ help = (
2526+ "Allows installation of packages from 'dirty' git clones instead of failing."
2527+ ),
2528+ )
25152529 add_uservar_args (sub_parser )
25162530
25172531 # bundle
@@ -2569,6 +2583,13 @@ def argparser():
25692583 " left blank to indicate that the latest available version should be"
25702584 " used." ,
25712585 )
2586+ sub_parser .add_argument (
2587+ "--ignore-dirty-git" ,
2588+ action = "store_true" ,
2589+ help = (
2590+ "Allows installation of packages from 'dirty' git clones instead of failing."
2591+ ),
2592+ )
25722593
25732594 # unbundle
25742595 sub_parser = command_parser .add_parser (
0 commit comments