]> git.phdru.name Git - git-scripts.git/commitdiff
Refactor(set-commit-date.py): Use git_log.stdout as an iterator
authorOleg Broytman <phd@phdru.name>
Fri, 27 Apr 2018 21:41:01 +0000 (00:41 +0300)
committerOleg Broytman <phd@phdru.name>
Fri, 27 Apr 2018 21:41:01 +0000 (00:41 +0300)
set-commit-date.py

index dc6a5fb732d93a0499323e9197305797a24172d8..71594ae3899e896a2d50901d7bf873178b7fdf0c 100755 (executable)
@@ -18,10 +18,7 @@ git_log = subprocess.Popen(['git', 'log', '-m', '--first-parent',
 filenames = set()
 # stages: 1 - start of commit, 2 - timestamp, 3 - empty line, 4 - files
 stage = 1
-while True:
-    line = git_log.stdout.readline()
-    if not line:  # EOF
-        break
+for line in git_log.stdout:
     line = line.strip()
     if (stage in (1, 4)) and (line == separator):  # Start of a commit
         stage = 2