]> git.phdru.name Git - git-scripts.git/blobdiff - set-commit-date.py
Refactor: Edit `.git/description` as the last step
[git-scripts.git] / set-commit-date.py
index 74972e4653225207864e67fe3c603a7448e2471e..67d2c4f98aa069c786ad857c68c37bf9daa89eda 100755 (executable)
@@ -34,7 +34,8 @@ separator = '----- GIT LOG SEPARATOR -----'
 
 git_log = subprocess.Popen(['git', 'log', '-m', '--first-parent',
                             '--name-status', '--no-color',
-                            '--format=%s%%n%%%st' % (separator, date_format)],
+                            '--pretty=tformat:%s%%n%%%st' % (
+                                separator, date_format)],
                            stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
                            universal_newlines=True)
 changed_files = set()
@@ -66,7 +67,7 @@ for line in git_log.stdout:
             deleted_files.add(filename)
         if filename not in deleted_files and filename not in changed_files:
             changed_files.add(filename)
-            if os.path.exists(filename):
+            if os.path.exists(filename) and not os.path.islink(filename):
                 os.utime(filename, (time, time))
     else:
         raise ValueError("stage: %d, line: %s" % (stage, line))