Skip to content

Instantly share code, notes, and snippets.

@minrk
Created July 10, 2020 08:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save minrk/7a65c9763adc1b24e18a058661b95939 to your computer and use it in GitHub Desktop.
Save minrk/7a65c9763adc1b24e18a058661b95939 to your computer and use it in GitHub Desktop.
import os
from tempfile import TemporaryDirectory
from subprocess import check_call
with TemporaryDirectory() as td:
env = {
"HOME": td,
"GIT_COMMITTER_EMAIL": "test@example.com",
"GIT_COMMITTER_NAME": "test",
"GIT_AUTHOR_EMAIL": "test@example.com",
"GIT_AUTHOR_NAME": "test",
}
os.chdir(td)
check_call(["git", "init"], env=env)
with open("f", "w") as f:
f.write("test")
check_call(["git", "add", "f"], env=env)
check_call(["git", "commit", "-m", "test"], env=env)
print("log")
# check_call(["git", "log", "-1"], env=env)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment