summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2016-12-03 19:08:42 +0000
committerRay Strode <rstrode@redhat.com>2016-12-03 19:08:42 +0000
commit44543c267876afff2a8b7ad9e32b1a9063e6e877 (patch)
tree4caa2e2b037a9a2295b1f71eaa454ac20e056cca
parent8161e1604775564b94c12e159fd3d8fa3d5364bb (diff)
post-receive-mirror-github: be more forgiving of description
Right now we're failing if the description has newlines in it!
-rwxr-xr-xpost-receive-mirror-github7
1 files changed, 4 insertions, 3 deletions
diff --git a/post-receive-mirror-github b/post-receive-mirror-github
index 166b9b3..292b3dc 100755
--- a/post-receive-mirror-github
+++ b/post-receive-mirror-github
@@ -28,6 +28,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
+import codecs
import os
import sys
import requests
@@ -69,8 +70,8 @@ class GitHub:
return
try:
- description_file = open('description')
- description = description_file.read().rstrip()
+ description_file = codecs.open('description', encoding='utf-8')
+ description = description_file.read().replace('\n', ' ').rstrip()
description_file.close()
except:
description = ''
@@ -113,7 +114,7 @@ def main ():
if not gh.check_if_repo_exists(repo_name):
gh.create_github_repo (repo_name)
try:
- command = 'git push --mirror git@github.com:%s/%s' % (ORGANIZATION, github_name)
+ command = 'git push --force --no-verify --mirror git@github.com:%s/%s' % (ORGANIZATION, github_name)
out = tempfile.NamedTemporaryFile (prefix="github",suffix="std")
err = tempfile.NamedTemporaryFile (prefix="github",suffix="err")
subprocess.check_call(shlex.split(command), stderr=err, stdout=out)