git: Full length SHA-1 in, full length SHA-1 out.
This removes ambiguity at the expense of slight backward incompatibility.
This commit is contained in:
parent
a130a8e614
commit
9af05f4d2f
1 changed files with 4 additions and 5 deletions
|
@ -41,7 +41,8 @@ options:
|
||||||
default: "HEAD"
|
default: "HEAD"
|
||||||
description:
|
description:
|
||||||
- What version of the repository to check out. This can be the
|
- 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:
|
remote:
|
||||||
required: false
|
required: false
|
||||||
default: "origin"
|
default: "origin"
|
||||||
|
@ -107,7 +108,7 @@ import tempfile
|
||||||
def get_version(git_path, dest):
|
def get_version(git_path, dest):
|
||||||
''' samples the version of the git repo '''
|
''' samples the version of the git repo '''
|
||||||
os.chdir(dest)
|
os.chdir(dest)
|
||||||
cmd = "%s show --abbrev-commit" % (git_path,)
|
cmd = "%s show" % (git_path,)
|
||||||
sha = os.popen(cmd).read().split("\n")
|
sha = os.popen(cmd).read().split("\n")
|
||||||
sha = sha[0].split()[1]
|
sha = sha[0].split()[1]
|
||||||
return sha
|
return sha
|
||||||
|
@ -354,8 +355,7 @@ def main():
|
||||||
if rc != 0:
|
if rc != 0:
|
||||||
module.fail_json(msg=err)
|
module.fail_json(msg=err)
|
||||||
# exit if already at desired sha version
|
# exit if already at desired sha version
|
||||||
# abbreviate version in case full sha is given
|
if before == version:
|
||||||
if before == str(version)[:7]:
|
|
||||||
module.exit_json(changed=False)
|
module.exit_json(changed=False)
|
||||||
# check or get changes from remote
|
# check or get changes from remote
|
||||||
remote_head = get_remote_head(git_path, module, dest, version, remote)
|
remote_head = get_remote_head(git_path, module, dest, version, remote)
|
||||||
|
@ -370,7 +370,6 @@ def main():
|
||||||
else:
|
else:
|
||||||
changed = True
|
changed = True
|
||||||
else:
|
else:
|
||||||
remote_head = remote_head[0:7]
|
|
||||||
if before != remote_head:
|
if before != remote_head:
|
||||||
changed = True
|
changed = True
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue