about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/article.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/article.py b/src/article.py
index 4fff8b5..31223f6 100644
--- a/src/article.py
+++ b/src/article.py
@@ -145,8 +145,12 @@ class ArticleGenerator:
         article_args[
             'url'] = f'{"/" if article_args["web_dir"] else ""}{"/".join(article_args["web_dir"])}/{article_args["name"]}'
 
-        git_date = subprocess.run(['git', 'log', '-1', '--pretty=format:%ci', pathlib.Path(article_args['git_path']) \
-                .relative_to(self.articles_path)], cwd=self.articles_path, capture_output=True, text=True).stdout
+        try:
+            git_date = subprocess.run(['git', 'log', '-1', '--pretty=format:%ci', pathlib.Path(article_args['git_path']) \
+                    .relative_to(self.articles_path)], cwd=self.articles_path, capture_output=True, text=True).stdout
+        except FileNotFoundError:
+            logger.warning('"git" isn\'t installed, modified dates will use file system (worse data)')
+            git_date = ''
         if git_date == '':
             logger.warning("Article folder is not a git directory, modified dates will use file system (worse data)")
             # Get article modified date time from file system