]> git.phdru.name Git - git-scripts.git/commitdiff
Minor refactoring
authorOleg Broytman <phd@phdru.name>
Tue, 12 Apr 2016 10:42:12 +0000 (13:42 +0300)
committerOleg Broytman <phd@phdru.name>
Tue, 12 Apr 2016 10:42:12 +0000 (13:42 +0300)
set-commit-date.py

index 9588bd87aa26e991006637b3e7779c2df82ffa99..c5d49d4225e7864bfdc7710e83179da805d0289b 100755 (executable)
@@ -18,7 +18,10 @@ 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 +33,6 @@ while True:
             continue
         stage = 4
         assert line == '', line
-    elif not line:  # EOF
-        break
     elif stage == 4:
         filename = line
         if filename not in filenames: