summaryrefslogtreecommitdiff
path: root/source_control
diff options
context:
space:
mode:
authorToshio Kuratomi <a.badger@gmail.com>2016-09-01 04:19:15 -0700
committerGitHub <noreply@github.com>2016-09-01 04:19:15 -0700
commit7e79c59d386d43182bc078123995674476b3a60e (patch)
tree1451d671a222a263b01c4f2d0851a8d7a91db518 /source_control
parentceddebaf28f35c6d65838000a94e843f66e46079 (diff)
downloadansible-modules-core-7e79c59d386d43182bc078123995674476b3a60e.tar.gz
to_text, to_bytes, and to_native now have surrogate_or_strict error handler (#4630)
On python3, we want to use the surrogateescape error handler if available for filesystem paths and the like. On python2, have to use strict in these circumstances. Use the new error strategy for to_text, to_bytes, and to_native that allows this.
Diffstat (limited to 'source_control')
-rw-r--r--source_control/git.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/source_control/git.py b/source_control/git.py
index 1641eac6..570350ff 100644
--- a/source_control/git.py
+++ b/source_control/git.py
@@ -483,7 +483,7 @@ def get_remote_head(git_path, module, dest, version, remote, bare):
def is_remote_tag(git_path, module, dest, remote, version):
cmd = '%s ls-remote %s -t refs/tags/%s' % (git_path, remote, version)
(rc, out, err) = module.run_command(cmd, check_rc=True, cwd=dest)
- if to_bytes(version) in out:
+ if to_bytes(version, errors='surrogate_or_strict') in out:
return True
else:
return False
@@ -513,7 +513,7 @@ def get_tags(git_path, module, dest):
def is_remote_branch(git_path, module, dest, remote, version):
cmd = '%s ls-remote %s -h refs/heads/%s' % (git_path, remote, version)
(rc, out, err) = module.run_command(cmd, check_rc=True, cwd=dest)
- if to_bytes(version) in out:
+ if to_bytes(version, errors='surrogate_or_strict') in out:
return True
else:
return False