From 885b8dc4d0ccfbde0fe32ab3614ef0f3327c5f04 Mon Sep 17 00:00:00 2001 From: Rene Moser Date: Thu, 21 Apr 2016 10:41:03 +0200 Subject: [PATCH] git: fix status to use porcelain, ignore user configuration From the git status doc: --porcelain Give the output in an easy-to-parse format for scripts. This is similar to the short output, but will remain stable across Git versions and regardless of user configuration. See below for details. User configuration can break the git module from working as expected. --- lib/ansible/modules/source_control/git.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/modules/source_control/git.py b/lib/ansible/modules/source_control/git.py index 46c3ce1c1b..05d15e90c8 100644 --- a/lib/ansible/modules/source_control/git.py +++ b/lib/ansible/modules/source_control/git.py @@ -356,7 +356,7 @@ def has_local_mods(module, git_path, dest, bare): if bare: return False - cmd = "%s status -s" % (git_path) + cmd = "%s status --porcelain" % (git_path) rc, stdout, stderr = module.run_command(cmd, cwd=dest) lines = stdout.splitlines() lines = filter(lambda c: not re.search('^\\?\\?.*$', c), lines)