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.
master
nathaniel smith 2017-10-02 22:37:19 -07:00
parent 729b63f78a
commit 6a7f95e118
2 changed files with 7 additions and 6 deletions

View File

@ -26,15 +26,16 @@ def make_commit(repo_path, author_name, author_email):
return return
repo = gitpython.Repo(repo_path) repo = gitpython.Repo(repo_path)
index = repo.index index = repo.index
repo.git.add(['--all'])
index.add([path for (path, _), __ in index.entries.items()])
actor = gitpython.Actor(author_name, author_email) actor = gitpython.Actor(author_name, author_email)
index.commit('wiki update', author=actor, committer=actor) index.commit('wiki update', author=actor, committer=actor)
def push_all(repo_path): def push_hard(local_repo_path, remote_repo_path):
repo = gitpython.Repo(repo_path) local_repo = gitpython.Repo(local_repo_path)
repo.remotes['origin'].push() local_repo.remotes['origin'].push()
remote = gitpython.Repo(remote_repo_path)
remote.git.reset(['--hard', 'HEAD'])
def pull_from_origin(repo_path): def pull_from_origin(repo_path):
repo = gitpython.Repo(repo_path) repo = gitpython.Repo(repo_path)

View File

@ -137,7 +137,7 @@ def publish(config, local_repo_path):
git.pull_from_origin(local_repo_path) git.pull_from_origin(local_repo_path)
click.echo('Pushing your changes...') 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.echo('Compiling wiki to {}'.format(config.publish_path))
click.confirm(WIPE_PROMPT.format(config.publish_path), abort=True) click.confirm(WIPE_PROMPT.format(config.publish_path), abort=True)