diff options
author | Zuul <zuul@review.opendev.org> | 2022-04-11 05:43:23 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2022-04-11 05:43:23 +0000 |
commit | bf760f221f22f2c771461d27d52d4caba57b5d25 (patch) | |
tree | 8c882f39e25dfe01b31774e3531c5a3e8bde924d /git_review | |
parent | bb58ee198cffaedb5e16fd1220996a9d331d2b4c (diff) | |
parent | 5bfaa4a6f355a6820fe16c1aea77a01ba7b97eaa (diff) | |
download | git-review-bf760f221f22f2c771461d27d52d4caba57b5d25.tar.gz |
Merge "Force use of scp rather than sftp when possible"
Diffstat (limited to 'git_review')
-rw-r--r-- | git_review/cmd.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/git_review/cmd.py b/git_review/cmd.py index fe20c99..15f3121 100644 --- a/git_review/cmd.py +++ b/git_review/cmd.py @@ -373,9 +373,17 @@ def set_hooks_commit_msg(remote, target_file): userhost = hostname # OS independent target file scp_target_file = target_file.replace(os.sep, "/") + + # Get scp options + scp_out = run_command("scp") + scp_opts = scp_out[scp_out.index("[") + 2:scp_out.index("]")] + cmd = ["scp", userhost + ":hooks/commit-msg", scp_target_file] if port is not None: cmd.insert(1, "-P%s" % port) + # Force scp protocol if the -O option is available + if "O" in scp_opts: + cmd.insert(1, "-O") if VERBOSE: hook_url = 'scp://%s%s/hooks/commit-msg' \ |