Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion build_docs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ from __future__ import print_function
import logging
from os import environ, getgid, getuid
from os.path import basename, dirname, exists, expanduser, isdir
from os.path import join, realpath
from os.path import join, normpath, realpath
import re
import subprocess
from sys import platform, version_info
Expand Down Expand Up @@ -182,10 +182,12 @@ def run_build_docs(args):
return repo_mount + path[len(repo_root):]

def mount_alternates(path_in_repo):
# We'd prefer to use --absolute-git-dir here but not all users have it
git_dir = subprocess.check_output(
['git', 'rev-parse', '--git-dir'],
cwd=path_in_repo)
git_dir = git_dir.decode('utf-8').strip()
git_dir = normpath(join(path_in_repo, git_dir))
alternates_file = git_dir + '/objects/info/alternates'
if not exists(alternates_file):
return
Expand Down Expand Up @@ -318,6 +320,10 @@ def run_build_docs(args):
m.group('repo'), m.group('branch'), mounted_path))
arg = args.next_arg()

# Mount alternatives used by the docs repo if there are any in case we have
# to use git on the docs repo itself.
mount_alternates(DIR)

if saw_doc and not saw_out:
# If you don't specify --out then we dump the output into
# $pwd/html_docs to keep backwards compatibility with build_docs.pl.
Expand Down