Skip to content
Snippets Groups Projects
Commit 80fc055b authored by Hans Fangohr's avatar Hans Fangohr Committed by Ashwin Kumar Karnad
Browse files

Set user and email for git commit.

parent df5f2163
No related branches found
No related tags found
3 merge requests!19Move linux-debian11 into main,!17split one test into three,!9force `subprocess.run` to check return code is 0
......@@ -34,8 +34,13 @@ def create_mock_git_repository(target_directory, create_directory=True):
subprocess.run("echo 'fake content' > readme.txt", shell=True, check=True)
subprocess.run("git add readme.txt", shell=True, check=True)
subprocess.run("pwd", shell=True)
# if email and username are not available (such as on naked test container),
# git may complain. We set a temporary user for this one commit to work around
# that.
user_details = "-c user.name='Tes Ta' -c user.email='tester@some-ci.org'"
subprocess.run(
'git commit -m "first commit" readme.txt', shell=True, check=True
f'git {user_details} commit -m "first commit" readme.txt', shell=True, check=True
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment