At the end of a Python program I have:
subprocess.call(["git", "add", "."], shell=True)
subprocess.call(["git", "commit", "-m", "'{}'".format("commit message"), "--allow-empty"], shell=True)
This commit has no changes from the previous commit besides the commit message, hence the --allow-empty
.
When I run git status
in my repository, I get that all of the files are not staged for commit (and I cannot re-base because of this).
However, if I comment those two lines out, run the program again, and manually run in shell once the program is finished:
git add .
git commit -m "commit message"
The files are all added and committed and I am able to re-base successfully.
Even when adding another two subprocess git add
and git commit
commands, with or without --allow-empty
to the end of the program, the only way to actually add and commit the files is manually through a shell.
Am I missing something here? Shouldn't the subprocess hypothetically be doing the exact same thing as the shell commands?