Skip to content

Commit f3bf635

Browse files
pillo79kartben
authored andcommitted
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 <[email protected]>
1 parent 7c50c02 commit f3bf635

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

doc/_extensions/zephyr/gh_utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ def git_info_filter(app: Sphinx, pagename) -> tuple[str, str] | None:
211211
.decode("utf-8")
212212
.strip()
213213
)
214+
if not date_and_sha1: # added but not committed
215+
return None
214216
date, sha1 = date_and_sha1.split(" ", 1)
215217
date_object = datetime.fromtimestamp(int(date))
216218
last_update_fmt = app.config.html_last_updated_fmt

0 commit comments

Comments
 (0)