浏览代码

Fix file_exists helper under Windows

Turns out git cat-file uses / as path separator and thus would not
be able to find docs\conf.py on a Windows system.

Fixes #18
Gina Häußge 4 年之前
父节点
当前提交
dad6e3b527
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      sphinx_multiversion/git.py

+ 5 - 0
sphinx_multiversion/git.py

@@ -2,6 +2,7 @@
 import collections
 import datetime
 import logging
+import os
 import re
 import subprocess
 import tarfile
@@ -119,6 +120,10 @@ def get_refs(
 
 
 def file_exists(gitroot, refname, filename):
+    if os.sep != "/":
+        # Git requires / path sep, make sure we use that
+        filename = filename.replace(os.sep, "/")
+
     cmd = (
         "git",
         "cat-file",