Merge pull request 'git: dont pass additional cwd' (#331) from Mic92-docs into main
This commit is contained in:
commit
f6398c85bb
@ -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)
|
||||
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}"
|
||||
)
|
||||
commit_file(settings_file, commit_message=f"Set option {option_description}")
|
||||
|
||||
|
||||
# takes a (sub)parser and configures it
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user