]> git.phdru.name Git - git-scripts.git/commitdiff
Feat(set-commit-date.py): chdir to git root
authorOleg Broytman <phd@phdru.name>
Tue, 27 Nov 2018 19:27:09 +0000 (22:27 +0300)
committerOleg Broytman <phd@phdru.name>
Tue, 27 Nov 2018 19:31:44 +0000 (22:31 +0300)
Necessary because `git --log --name-only` produces paths relative to
the root.

set-commit-date.py

index 71594ae3899e896a2d50901d7bf873178b7fdf0c..7f481f36960251b382b9d0b756fed9563e521619 100755 (executable)
@@ -8,6 +8,10 @@
 import os
 import subprocess
 
+git_root = subprocess.check_output(['git', 'rev-parse', '--show-toplevel'],
+                                   universal_newlines=True).rstrip('\n')
+os.chdir(git_root)
+
 separator = '----- GIT LOG SEPARATOR -----'
 
 git_log = subprocess.Popen(['git', 'log', '-m', '--first-parent',