]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
fix: do not commit when we deleted nothing
authorMathias Klette <mathias.klette@profitbricks.com>
Thu, 15 Sep 2011 16:30:55 +0000 (18:30 +0200)
committerMathias Klette <mathias.klette@profitbricks.com>
Thu, 15 Sep 2011 16:30:55 +0000 (18:30 +0200)
debian_build.py
lib/git_helper.py

index 07c91576680a4f3853eef7ced0e5f20365ca7f70..502ca54e7df0e14e49eba224d98b11c87b78d389 100755 (executable)
@@ -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')
 
index 885b4907e731d1b86c66ade91d8ddf1da2b20fbe..fec9684cb2684867984978c87d1d3b0e0954489b 100644 (file)
@@ -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