Merge pull request 'git: dont pass additional cwd' (#331) from Mic92-docs into main
All checks were successful
checks-impure / test (push) Successful in 9s
checks / test (push) Successful in 22s
assets1 / test (push) Successful in 6s

This commit is contained in:
clan-bot 2023-09-22 14:58:15 +00:00
commit f6398c85bb
2 changed files with 5 additions and 6 deletions

View File

@ -231,10 +231,10 @@ def set_option(
settings_file.parent.mkdir(parents=True, exist_ok=True)
with open(settings_file, "w") as f:
json.dump(new_config, f, indent=2)
if settings_file.resolve().is_relative_to(get_clan_flake_toplevel()):
commit_file(
settings_file, commit_message=f"Set option {option_description}"
)
print(file=f) # add newline at the end of the file to make git happy
if settings_file.resolve().is_relative_to(get_clan_flake_toplevel()):
commit_file(settings_file, commit_message=f"Set option {option_description}")
# takes a (sub)parser and configures it

View File

@ -48,7 +48,7 @@ def _commit_file_to_git(repo_dir: Path, file_path: Path, commit_message: str) ->
)
# add the file to the git index
try:
subprocess.run(cmd, cwd=repo_dir, check=True)
subprocess.run(cmd, check=True)
except subprocess.CalledProcessError as e:
raise ClanError(
f"Failed to add {file_path} to git repository {repo_dir}:\n{shlex.join(cmd)}\n exited with {e.returncode}"
@ -80,7 +80,6 @@ def _commit_file_to_git(repo_dir: Path, file_path: Path, commit_message: str) ->
try:
subprocess.run(
cmd,
cwd=repo_dir,
check=True,
)
except subprocess.CalledProcessError as e: