doc: gh_utils: ignore added-but-not-committed files
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 <l.burelli@arduino.cc>
This commit is contained in:
parent
7c50c0231c
commit
f3bf6357c7
1 changed files with 2 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue