]> git.phdru.name Git - git-scripts.git/commitdiff
Fix(set-commit-date.py): Skip symlinks
authorOleg Broytman <phd@phdru.name>
Sun, 2 Feb 2020 15:43:33 +0000 (18:43 +0300)
committerOleg Broytman <phd@phdru.name>
Sun, 2 Feb 2020 15:43:33 +0000 (18:43 +0300)
An earlier symlink to a file should not override the later file.

set-commit-date.py

index 74972e4653225207864e67fe3c603a7448e2471e..c0aaa8cf999bae085a6ab0c484a7cc23edc7f5bf 100755 (executable)
@@ -66,7 +66,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))