diff --git a/agentstack/repo.py b/agentstack/repo.py index f1e10465..0ead48b0 100644 --- a/agentstack/repo.py +++ b/agentstack/repo.py @@ -1,11 +1,10 @@ from typing import Optional +from types import ModuleType from pathlib import Path import shutil -import git from agentstack import conf, log from agentstack.exceptions import EnvironmentError - MAIN_BRANCH_NAME = "main" AUTOMATION_NOTE = "\n\n(This commit was made automatically by AgentStack)" @@ -15,6 +14,14 @@ _USE_GIT = None # global state to disable git for this run +# The python git module prints an excessive error message when git is not +# installed. We always want to allow git support to fail silently. +try: + import git +except ImportError: + _USE_GIT = False + + def should_track_changes() -> bool: """ If git has been disabled for this run, return False. Next, look for the value