Skip to content

Commit

Permalink
doc: gh_utils: ignore added-but-not-committed files
Browse files Browse the repository at this point in the history
If the file is added to the index, but not committed yet, the 'git'
command will return an empty string. This patch checks for this case and
treats it as if the file was not tracked at all.

Signed-off-by: Luca Burelli <[email protected]>
  • Loading branch information
pillo79 authored and kartben committed Jan 16, 2025
1 parent 7c50c02 commit f3bf635
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions doc/_extensions/zephyr/gh_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ def git_info_filter(app: Sphinx, pagename) -> tuple[str, str] | None:
.decode("utf-8")
.strip()
)
if not date_and_sha1: # added but not committed
return None
date, sha1 = date_and_sha1.split(" ", 1)
date_object = datetime.fromtimestamp(int(date))
last_update_fmt = app.config.html_last_updated_fmt
Expand Down

0 comments on commit f3bf635

Please sign in to comment.