|
|
|
@ -26,7 +26,7 @@ def git_directories(startdir) -> Path:
|
|
|
|
|
for dirpath, dirnames, _ in os.walk(startdir):
|
|
|
|
|
if any(re.search(ignore, dirpath) for ignore in IGNORES):
|
|
|
|
|
continue
|
|
|
|
|
if set(['info', 'objects', 'refs']).issubset(set(dirnames)):
|
|
|
|
|
if set(["info", "objects", "refs"]).issubset(set(dirnames)):
|
|
|
|
|
yield Path(dirpath)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -39,10 +39,17 @@ def working_directory(directory: Path):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@click.command
|
|
|
|
|
@click.argument('topdirs', nargs=-1, type=click.Path(exists=True, file_okay=False,
|
|
|
|
|
path_type=Path))
|
|
|
|
|
@click.option('-l', '--list', 'list_', is_flag=True, default=False,
|
|
|
|
|
help='Just list the dirty directories')
|
|
|
|
|
@click.argument(
|
|
|
|
|
"topdirs", nargs=-1, type=click.Path(exists=True, file_okay=False, path_type=Path)
|
|
|
|
|
)
|
|
|
|
|
@click.option(
|
|
|
|
|
"-l",
|
|
|
|
|
"--list",
|
|
|
|
|
"list_",
|
|
|
|
|
is_flag=True,
|
|
|
|
|
default=False,
|
|
|
|
|
help="Just list the dirty directories",
|
|
|
|
|
)
|
|
|
|
|
def search_dirty(topdirs, list_):
|
|
|
|
|
"""Search for dirty git working directories in TOPDIRS"""
|
|
|
|
|
if len(topdirs) == 0:
|
|
|
|
@ -61,14 +68,20 @@ def search_dirty(topdirs, list_):
|
|
|
|
|
out = subprocess.check_output(['git', 'status', '-s'], stderr=subprocess.STDOUT)
|
|
|
|
|
if len(out) > 0:
|
|
|
|
|
if not list_:
|
|
|
|
|
print('== {}\n{}'.format(work_tree_directory, out.decode('utf-8')))
|
|
|
|
|
print(
|
|
|
|
|
f"== {work_tree_directory}\n"
|
|
|
|
|
f"{out.decode("utf-8")}"
|
|
|
|
|
)
|
|
|
|
|
else:
|
|
|
|
|
print(work_tree_directory)
|
|
|
|
|
except subprocess.CalledProcessError as e:
|
|
|
|
|
print((Fore.RED + 'git status is unhappy with {}' + Fore.RESET)
|
|
|
|
|
.format(work_tree_directory))
|
|
|
|
|
print(
|
|
|
|
|
(
|
|
|
|
|
Fore.RED + "git status is unhappy with {}" + Fore.RESET
|
|
|
|
|
).format(work_tree_directory)
|
|
|
|
|
)
|
|
|
|
|
print(e.output)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
search_dirty()
|
|
|
|
|