Skip to content

Commit

Permalink
Fix building the website when a file has only chore commits (#1224)
Browse files Browse the repository at this point in the history
#1223 was a chore PR which added a file. This exposed a bug in our Git
mdbook preprocessor, which filters out chore commits before generating
the "Created by" line.

Now if there are no non-chore commits touching a file, the file is
generated without "Created by".
  • Loading branch information
VojtechStep authored Nov 18, 2024
1 parent 4eacd3a commit 6a4fd25
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions scripts/preprocessor_git_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,14 @@ def get_author_element_for_file(filename, include_contributors, contributors):
'HEAD', '--', filename
], capture_output=True, text=True, check=True).stdout.splitlines()

# Collect authors and sort by number of commits
author_names = [
author['displayName']
for author in sorted_authors_from_raw_shortlog_lines(raw_authors_git_output, contributors)
]
attribution_text = f'<p><i>Content created by {format_multiple_authors_attribution(author_names)}.</i></p>'
# If all commits to a file are chore commits, then there are no authors
if raw_authors_git_output:
# Collect authors and sort by number of commits
author_names = [
author['displayName']
for author in sorted_authors_from_raw_shortlog_lines(raw_authors_git_output, contributors)
]
attribution_text = f'<p><i>Content created by {format_multiple_authors_attribution(author_names)}.</i></p>'

file_log_output = subprocess.run([
'git', 'log',
Expand Down

0 comments on commit 6a4fd25

Please sign in to comment.