Skip to content

Commit 45b96a7

Browse files
committed
fix git config
1 parent 679879b commit 45b96a7

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

mytonctrl/mytonctrl.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,26 @@ def check_vport(local, ton):
225225
color_print(local.translate("vport_error"))
226226
#end define
227227

228+
229+
def fix_git_config(git_path: str):
230+
args = ["git", "status"]
231+
try:
232+
process = subprocess.run(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=git_path, timeout=3)
233+
err = process.stderr.decode("utf-8")
234+
except Exception as e:
235+
err = str(e)
236+
if err:
237+
if 'git config --global --add safe.directory' in err:
238+
args = ["git", "config", "--global", "--add", "safe.directory", git_path]
239+
subprocess.run(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=3)
240+
else:
241+
raise Exception(f'Failed to check git status: {err}')
242+
243+
228244
def check_git(input_args, default_repo, text):
229245
src_dir = "/usr/src"
230246
git_path = f"{src_dir}/{default_repo}"
247+
fix_git_config(git_path)
231248
default_author = "ton-blockchain"
232249
default_branch = "master"
233250

0 commit comments

Comments
 (0)