From: Mathias Klette Date: Thu, 15 Sep 2011 16:30:55 +0000 (+0200) Subject: fix: do not commit when we deleted nothing X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=9913e7b1d3d40256cc1b2e26e75f97c16e58c188;p=profitbricks%2Fjenkins-build-scripts.git fix: do not commit when we deleted nothing --- diff --git a/debian_build.py b/debian_build.py index 07c9157..502ca54 100755 --- a/debian_build.py +++ b/debian_build.py @@ -284,7 +284,12 @@ if __name__ == '__main__': cleanup_files = ('.gbp.conf', 'debian/gbp.conf', '.git/gbp.conf') result = git_helper.git_cleanup_branch(cleanup_files) - result = git_helper.git_commit("Cleanup branch for correct builds.") + commit_files = result["goods"].keys() + if len(commit_files) > 0: + git_helper.git_commit( + "Cleanup branch for correct builds.", + commit_files + ) pb_version_path = os.path.join('debian', 'pb_version') diff --git a/lib/git_helper.py b/lib/git_helper.py index 885b490..fec9684 100644 --- a/lib/git_helper.py +++ b/lib/git_helper.py @@ -166,7 +166,10 @@ def git_cleanup_branch(paths): the branch being used. That way our central configuration is ignored and builds fail. """ - result = dict() + result = { + "goods": dict() + "bads": dict() + } for path in paths: try: if not os.path.exists(path): @@ -193,9 +196,9 @@ def git_cleanup_branch(paths): ) cmd(path) except Exception, error: - result.setdefault(path, error) + result["bads"].setdefault(path, error) else: - result.setdefault(path, True) + result["goods"].setdefault(path, True) return result