add CLAN_NO_COMMIT env var to disable committing

This is required when calling vars generators for generating vars for
tests
This commit is contained in:
DavHau
2025-04-07 18:59:11 +07:00
parent a10527a69d
commit 60133015f5

View File

@@ -1,3 +1,4 @@
import os
from pathlib import Path from pathlib import Path
from .cmd import Log, RunOpts, run from .cmd import Log, RunOpts, run
@@ -27,6 +28,8 @@ def commit_files(
repo_dir: Path, repo_dir: Path,
commit_message: str | None = None, commit_message: str | None = None,
) -> None: ) -> None:
if os.environ.get("CLAN_NO_COMMIT", None):
return
if not file_paths: if not file_paths:
return return
# check that the file is in the git repository # check that the file is in the git repository