Skip to content

Commit

Permalink
Fix for pgp signed commits
Browse files Browse the repository at this point in the history
Now, instead of `git cat-file -p $SHA` and skipping through non-empty lines
in the commit header, we just run `git log --format=%B -n 1 $SHA` and get
commit message directly.

Previous method could break if commit header contained empty lines - this
is a case for signed commits
  • Loading branch information
Aleksei Shpakovskii committed Aug 3, 2018
1 parent a39a35f commit 7c3442a
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions misc/changelog-generator/changelog-generator
Expand Up @@ -110,12 +110,15 @@ else:

for repo in repos:
os.chdir(repo)
sha_list = subprocess.Popen(["git", "rev-list", "--reverse"] + sys.argv[1:], stdout=subprocess.PIPE)
sha_list = subprocess.Popen(
["git", "rev-list", "--no-merges", "--reverse"] + sys.argv[1:],
stdout=subprocess.PIPE)
for sha in sha_list.stdout:
sha = sha.decode().rstrip('\n')
blob = subprocess.Popen(["git", "cat-file", "-p", sha], stdout=subprocess.PIPE)
blob = subprocess.Popen(
["git", "log", "--format=%B", "-n", "1", sha],
stdout=subprocess.PIPE)

msg_started = False
title_fetched = False
title = ""
commit_msg = ""
Expand All @@ -125,19 +128,12 @@ for repo in repos:
log_entry = ""
for line in blob.stdout:
line = line.decode().rstrip('\r\n')
if line == "":
if not msg_started:
msg_started = True
continue

if log_entry:
add_entry(sha, log_entry)
log_entry = ""
if line == "" and log_entry:
add_entry(sha, log_entry)
log_entry = ""
log_entry_local = False

if not msg_started:
continue

# Tracker reference, remove from string.
for match in re.finditer(TRACKER_REGEX, line, re.IGNORECASE):
if not SHA_TO_TRACKER.get(sha):
Expand Down

0 comments on commit 7c3442a

Please sign in to comment.