From 9af05f4d2fecdd52f792e860c1278c2c29fbeb90 Mon Sep 17 00:00:00 2001 From: Yap Sok Ann Date: Wed, 16 Oct 2013 14:16:25 +0800 Subject: [PATCH] git: Full length SHA-1 in, full length SHA-1 out. This removes ambiguity at the expense of slight backward incompatibility. --- library/source_control/git | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/library/source_control/git b/library/source_control/git index b839540e84..cbc005f539 100644 --- a/library/source_control/git +++ b/library/source_control/git @@ -41,7 +41,8 @@ options: default: "HEAD" description: - What version of the repository to check out. This can be the - git I(SHA), the literal string C(HEAD), a branch name, or a tag name. + full 40-character I(SHA-1) hash, the literal string C(HEAD), a + branch name, or a tag name. remote: required: false default: "origin" @@ -107,7 +108,7 @@ import tempfile def get_version(git_path, dest): ''' samples the version of the git repo ''' os.chdir(dest) - cmd = "%s show --abbrev-commit" % (git_path,) + cmd = "%s show" % (git_path,) sha = os.popen(cmd).read().split("\n") sha = sha[0].split()[1] return sha @@ -354,8 +355,7 @@ def main(): if rc != 0: module.fail_json(msg=err) # exit if already at desired sha version - # abbreviate version in case full sha is given - if before == str(version)[:7]: + if before == version: module.exit_json(changed=False) # check or get changes from remote remote_head = get_remote_head(git_path, module, dest, version, remote) @@ -370,7 +370,6 @@ def main(): else: changed = True else: - remote_head = remote_head[0:7] if before != remote_head: changed = True else: