summaryrefslogtreecommitdiff
path: root/source_control/git.py
diff options
context:
space:
mode:
authorAndrew Widdersheim <awiddersheim@hotmail.com>2015-10-06 15:37:45 -0400
committerAndrew Widdersheim <awiddersheim@hotmail.com>2015-10-06 15:37:45 -0400
commite36e1339e8eba3e6dde2b2284d6785ccc5983c00 (patch)
treebb021e87ec0ea00b18708e6b8df831411cd2a633 /source_control/git.py
parent3a9d046f9667563ab3cd195aa387020cc955b1d6 (diff)
downloadansible-modules-core-e36e1339e8eba3e6dde2b2284d6785ccc5983c00.tar.gz
Fix detached head detection in is_not_a_branch()
Detached head detection seems to have broken somewhere a long the way because git decided to change how that situation looks when doing a 'git branch -a' which is performed by get_branches(). This is how git 1.7.1 displays this situation (which works): shell> git branch -a * (no branch) master This is the output from git 1.8.3.1 (which does not work): shell> git branch -a * (detached from e132711) master It looks like this same wording is used in the most recent version of git (2.6.1 as of writing this).
Diffstat (limited to 'source_control/git.py')
-rw-r--r--source_control/git.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/source_control/git.py b/source_control/git.py
index 4b162039..d42b284a 100644
--- a/source_control/git.py
+++ b/source_control/git.py
@@ -453,7 +453,7 @@ def is_local_branch(git_path, module, dest, branch):
def is_not_a_branch(git_path, module, dest):
branches = get_branches(git_path, module, dest)
for b in branches:
- if b.startswith('* ') and 'no branch' in b:
+ if b.startswith('* ') and ('no branch' in b or 'detached from' in b):
return True
return False