Skip to content

Commit cc686c6

Browse files
committed
Fix --no-git argument resolution.
The --no-git argument was superfluous as it was set to True by default. This commit flips this, and assumes git is not available, and will check and update only if the user asks for it (--no-git == False). To make this more clear I have renamed the variable to should_init_git.
1 parent b18ef20 commit cc686c6

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/specify_cli/__init__.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -794,10 +794,11 @@ def init(
794794
))
795795

796796
# Check git only if we might need it (not --no-git)
797-
git_available = True
797+
# Only set to True if the user wants it and the tool is available
798+
should_init_git = False
798799
if not no_git:
799-
git_available = check_tool("git", "https://git-scm.com/downloads")
800-
if not git_available:
800+
should_init_git = check_tool("git", "https://git-scm.com/downloads")
801+
if not should_init_git:
801802
console.print("[yellow]Git not found - will skip repository initialization[/yellow]")
802803

803804
# AI assistant selection
@@ -893,7 +894,7 @@ def init(
893894
tracker.start("git")
894895
if is_git_repo(project_path):
895896
tracker.complete("git", "existing repo detected")
896-
elif git_available:
897+
elif should_init_git:
897898
if init_git_repo(project_path, quiet=True):
898899
tracker.complete("git", "initialized")
899900
else:

0 commit comments

Comments
 (0)