From ca5d6f918f12cd0046988c09a234e75d6d2fb533 Mon Sep 17 00:00:00 2001 From: Dougal Matthews Date: Fri, 5 Jun 2015 14:52:09 +0100 Subject: [PATCH] Enable gh-deploy to work if the mkdocs.yml is not in the repo root Fixes #578 --- docs/about/release-notes.md | 2 ++ mkdocs/gh_deploy.py | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/about/release-notes.md b/docs/about/release-notes.md index 620ea45f..8b193ffa 100644 --- a/docs/about/release-notes.md +++ b/docs/about/release-notes.md @@ -17,11 +17,13 @@ You can determine your currently installed version using `mkdocs --version`: * Improve Unicode handling by ensuring that all YAML strings are loaded as Unicode. * Remove dependancy on the six library. (#583) +* Remove dependancy on the ghp-import library. (#547) * Add `--quiet` and `--verbose` options to all subcommands. * Add short options (`-a`) to most command line options. * Add copyright footer for readthedocs theme. * Bugfix: Fix a JavaScript encoding problem when searching with spaces. (#586) * Stack traces are no longer displayed on socket errors, just an error message. +* Bugfix: gh-deploy now works if the mkdocs.yml is not in the git repo root (#578) ## Version 0.13.3 (2015-06-02) diff --git a/mkdocs/gh_deploy.py b/mkdocs/gh_deploy.py index 5c557f47..9a4a5d2a 100644 --- a/mkdocs/gh_deploy.py +++ b/mkdocs/gh_deploy.py @@ -8,10 +8,12 @@ log = logging.getLogger(__name__) def gh_deploy(config, message=None): - if not os.path.exists('.git'): - log.info('Cannot deploy - this directory does not appear to be a git ' - 'repository') - return + proc = subprocess.Popen(['git', 'rev-parse', '--is-inside-work-tree'], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + proc.communicate() + if proc.wait() != 0: + log.error('Cannot deploy - this directory does not appear to be a git ' + 'repository') command = ['ghp-import', '-p', config['site_dir']]