[sysadmin-bin] Quote refs passed to git push



commit f5c5e003f3341b11172d1ac09c9f2ca65ff960c7
Author: Bartłomiej Piotrowski <bpiotrowski gnome org>
Date:   Fri Jan 31 11:09:28 2020 +0100

    Quote refs passed to git push

 git/post-receive-mirror-github | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/git/post-receive-mirror-github b/git/post-receive-mirror-github
index 0d38dd4..c7ce9da 100755
--- a/git/post-receive-mirror-github
+++ b/git/post-receive-mirror-github
@@ -193,7 +193,7 @@ def run_command(command):
     try:
         out = tempfile.NamedTemporaryFile(prefix="github",suffix="std")
         err = tempfile.NamedTemporaryFile(prefix="github",suffix="err")
-        subprocess.check_call(shlex.split(command), stderr=err, stdout=out)
+        subprocess.check_call(shlex.split(command), stderr=subprocess.PIPE, stdout=out)
         out.close()
         err.close()
     except subprocess.CalledProcessError:
@@ -235,7 +235,7 @@ def main():
         push_command = "git push --mirror git github com:{}/{}".format(gh.organization, github_repo_name)
     else:
         push_command_tpl = "git push --force git github com:{}/{} {}:mainline {}"
-        refs = ["refs/heads/{}".format(branch) for branch in doap_settings['branches'] if branch not in 
("master", "mainline")]
+        refs = ["\"refs/heads/{}\"".format(branch) for branch in doap_settings['branches'] if branch not in 
("master", "mainline")]
         push_command = push_command_tpl.format(gh.organization, github_repo_name, 
doap_settings['default_branch'], " ".join(refs))
 
     run_command(push_command)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]