]> git.phdru.name Git - git-scripts.git/blobdiff - set-commit-date.py
Feat(ls-assumed): Recognize files with skip-worktree bit
[git-scripts.git] / set-commit-date.py
index 70e393296053605689794d6aae43a7df67c7806d..dc6a5fb732d93a0499323e9197305797a24172d8 100755 (executable)
@@ -13,12 +13,16 @@ separator = '----- GIT LOG SEPARATOR -----'
 git_log = subprocess.Popen(['git', 'log', '-m', '--first-parent',
                             '--name-only', '--no-color',
                             '--format=%s%%n%%ct' % separator],
-                           stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+                           stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
+                           universal_newlines=True)
 filenames = set()
 # stages: 1 - start of commit, 2 - timestamp, 3 - empty line, 4 - files
 stage = 1
 while True:
-    line = git_log.stdout.readline().strip()
+    line = git_log.stdout.readline()
+    if not line:  # EOF
+        break
+    line = line.strip()
     if (stage in (1, 4)) and (line == separator):  # Start of a commit
         stage = 2
     elif stage == 2:
@@ -30,8 +34,6 @@ while True:
             continue
         stage = 4
         assert line == '', line
-    elif not line:
-        break
     elif stage == 4:
         filename = line
         if filename not in filenames: