Skip to content

Commit

Permalink
Add --ignore-dirty-git option to test and install commands
Browse files Browse the repository at this point in the history
  • Loading branch information
timwoj committed May 25, 2023
1 parent e1d8271 commit 5a528c1
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions zkg
Original file line number Diff line number Diff line change
Expand Up @@ -374,12 +374,12 @@ def is_local_git_repo_dirty(git_url):
return repo.is_dirty(untracked_files=True)


def check_local_git_repo(git_url):
def check_local_git_repo(git_url, allow_dirty):
if is_local_git_repo_url(git_url):
if not is_local_git_repo(git_url):
print_error(f"error: path {git_url} is not a git repository")
return False
if is_local_git_repo_dirty(git_url):
if not allow_dirty and is_local_git_repo_dirty(git_url):
print_error(f"error: local git clone at {git_url} is dirty")
return False

Expand Down Expand Up @@ -549,7 +549,7 @@ def cmd_test(manager, args, config, configfile):
package_infos = []

for name in args.package:
if not check_local_git_repo(name):
if not check_local_git_repo(name, args.ignore_dirty_git):
sys.exit(1)

version = args.version if args.version else active_git_branch(name)
Expand Down Expand Up @@ -619,7 +619,7 @@ def cmd_install(manager, args, config, configfile):
package_infos = []

for name in args.package:
if not check_local_git_repo(name):
if not check_local_git_repo(name, args.ignore_dirty_git):
sys.exit(1)

version = args.version if args.version else active_git_branch(name)
Expand Down Expand Up @@ -2471,6 +2471,12 @@ def argparser():
" the latest version tag, or if a package has none,"
' the default branch, like "main" or "master".',
)
sub_parser.add_argument(
"--ignore-dirty-git",
action="store_true",
help="Allows installation of packages from 'dirty' git clones instead"
" of failing.",
)

# install
sub_parser = command_parser.add_parser(
Expand Down Expand Up @@ -2512,6 +2518,12 @@ def argparser():
" the latest version tag, or if a package has none,"
' the default branch, like "main" or "master".',
)
sub_parser.add_argument(
"--ignore-dirty-git",
action="store_true",
help="Allows installation of packages from 'dirty' git clones instead"
" of failing.",
)
add_uservar_args(sub_parser)

# bundle
Expand Down

0 comments on commit 5a528c1

Please sign in to comment.