From: Oleg Broytman Date: Tue, 12 Apr 2016 10:42:12 +0000 (+0300) Subject: Minor refactoring X-Git-Url: https://git.phdru.name/?p=git-scripts.git;a=commitdiff_plain;h=889d6017bcc7c94e667bb4ef2ffbc003131dabf5 Minor refactoring --- diff --git a/set-commit-date.py b/set-commit-date.py index 9588bd8..c5d49d4 100755 --- a/set-commit-date.py +++ b/set-commit-date.py @@ -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: