X-Git-Url: http://unremediatedgender.space/source?p=Ultimately_Untrue_Thought.git;a=blobdiff_plain;f=provisioning%2Fpelican_scheduler.py;h=5fdc607ba1f558a6f4855a9539f258462a5d2a09;hp=8882e565f2fe32e1ecb3fb49d6f4735f2631456f;hb=d44c0f306fb82e0d775053c1f659e88c4c7c88cd;hpb=1cf814f52c06e6526831c1c73e58d2592ab9f5e0 diff --git a/provisioning/pelican_scheduler.py b/provisioning/pelican_scheduler.py index 8882e56..5fdc607 100755 --- a/provisioning/pelican_scheduler.py +++ b/provisioning/pelican_scheduler.py @@ -62,7 +62,21 @@ def schedule(command, when): def main(): # sync our "working" repo with the bare one - subprocess.run(["git", "pull"], cwd=WORKING_REPO) + + # but first, don't let the fact that this is running as a hook on the bare + # repo confuse us + our_env = os.environ.copy() + del our_env['GIT_DIR'] + + for git_cmd in [["git", "fetch", "origin"], + ["git", "reset", "--hard", "origin/master"]]: + subprocess.run(git_cmd, cwd=WORKING_REPO, env=our_env) + + # sitegen now! (even if there are no posts to queue, we can at least update + # /drafts/) and make any back-edits to published posts live + subprocess.run(SITEGEN_COMMAND, + # XXX: `shell=True` is contrary to the moral law + shell=True) # look for scheduled future posts future_publication_times = get_future_publication_times()