From 6a7f95e1189e693e8d9b9ba4a453245d04378e49 Mon Sep 17 00:00:00 2001 From: nathaniel smith Date: Mon, 2 Oct 2017 22:37:19 -0700 Subject: [PATCH] bugfix: new files weren't getting picked up. this commit goes for the nuclear option of adding everything locally, pushing, and then hard resetting the remote repo. --- tildewiki/git_wrapper.py | 11 ++++++----- tildewiki/main.py | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/tildewiki/git_wrapper.py b/tildewiki/git_wrapper.py index 84090fb..0bbe9a7 100644 --- a/tildewiki/git_wrapper.py +++ b/tildewiki/git_wrapper.py @@ -26,15 +26,16 @@ def make_commit(repo_path, author_name, author_email): return repo = gitpython.Repo(repo_path) index = repo.index - - index.add([path for (path, _), __ in index.entries.items()]) + repo.git.add(['--all']) actor = gitpython.Actor(author_name, author_email) index.commit('wiki update', author=actor, committer=actor) -def push_all(repo_path): - repo = gitpython.Repo(repo_path) - repo.remotes['origin'].push() +def push_hard(local_repo_path, remote_repo_path): + local_repo = gitpython.Repo(local_repo_path) + local_repo.remotes['origin'].push() + remote = gitpython.Repo(remote_repo_path) + remote.git.reset(['--hard', 'HEAD']) def pull_from_origin(repo_path): repo = gitpython.Repo(repo_path) diff --git a/tildewiki/main.py b/tildewiki/main.py index b84c88d..edb4665 100644 --- a/tildewiki/main.py +++ b/tildewiki/main.py @@ -137,7 +137,7 @@ def publish(config, local_repo_path): git.pull_from_origin(local_repo_path) click.echo('Pushing your changes...') - git.push_all(local_repo_path) + git.push_hard(local_repo_path, config.repo_path) click.echo('Compiling wiki to {}'.format(config.publish_path)) click.confirm(WIPE_PROMPT.format(config.publish_path), abort=True)