From f3bf6357c799191c230142ecb04994c0f232ed16 Mon Sep 17 00:00:00 2001 From: Luca Burelli Date: Thu, 16 Jan 2025 10:11:44 +0100 Subject: [PATCH] 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 --- doc/_extensions/zephyr/gh_utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/_extensions/zephyr/gh_utils.py b/doc/_extensions/zephyr/gh_utils.py index 67998cd4382..a2774faa1cd 100644 --- a/doc/_extensions/zephyr/gh_utils.py +++ b/doc/_extensions/zephyr/gh_utils.py @@ -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