Merge pull request 'git: dont pass additional cwd' (#331) from Mic92-docs into main
This commit is contained in:
@@ -231,10 +231,10 @@ def set_option(
|
|||||||
settings_file.parent.mkdir(parents=True, exist_ok=True)
|
settings_file.parent.mkdir(parents=True, exist_ok=True)
|
||||||
with open(settings_file, "w") as f:
|
with open(settings_file, "w") as f:
|
||||||
json.dump(new_config, f, indent=2)
|
json.dump(new_config, f, indent=2)
|
||||||
if settings_file.resolve().is_relative_to(get_clan_flake_toplevel()):
|
print(file=f) # add newline at the end of the file to make git happy
|
||||||
commit_file(
|
|
||||||
settings_file, commit_message=f"Set option {option_description}"
|
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
|
# 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
|
# add the file to the git index
|
||||||
try:
|
try:
|
||||||
subprocess.run(cmd, cwd=repo_dir, check=True)
|
subprocess.run(cmd, check=True)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
raise ClanError(
|
raise ClanError(
|
||||||
f"Failed to add {file_path} to git repository {repo_dir}:\n{shlex.join(cmd)}\n exited with {e.returncode}"
|
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:
|
try:
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
cmd,
|
cmd,
|
||||||
cwd=repo_dir,
|
|
||||||
check=True,
|
check=True,
|
||||||
)
|
)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user