From 5b77f4a073109d4b7b09cf6f4a1f086afececbcd Mon Sep 17 00:00:00 2001
From: jurgenhaas <juergen@paragon-es.de>
Date: Mon, 18 Jan 2021 09:34:12 +0100
Subject: [PATCH] Fix collect config for mode git

---
 tasks/collect_config/finish/git.yml      | 19 ++++++++++++++++---
 tasks/collect_config/prepare/git.yml     | 24 +++++++++++++++++++++---
 tasks/collect_config/prepare/gitflow.yml | 17 +----------------
 3 files changed, 38 insertions(+), 22 deletions(-)

diff --git a/tasks/collect_config/finish/git.yml b/tasks/collect_config/finish/git.yml
index 19101f1..7252e93 100644
--- a/tasks/collect_config/finish/git.yml
+++ b/tasks/collect_config/finish/git.yml
@@ -1,6 +1,19 @@
 ---
 # file: roles/drupal/tasks/config_collect/finish/git.yml
 
-- name: Set facts
-  set_fact:
-    dummy: yes
+- block:
+
+    - name: Push changes
+      shell: git push
+      args:
+        chdir: '{{ webRoot }}'
+      become: no
+      when: git_status.stdout != ''
+
+    - name: Delete webroot working copy
+      file:
+        path: '{{ webRoot }}'
+        state: absent
+
+  tags:
+    - deploy
diff --git a/tasks/collect_config/prepare/git.yml b/tasks/collect_config/prepare/git.yml
index 81d3f9a..8adf3d1 100644
--- a/tasks/collect_config/prepare/git.yml
+++ b/tasks/collect_config/prepare/git.yml
@@ -1,6 +1,24 @@
 ---
 # file: roles/drupal/tasks/config_collect/prepare/git.yml
 
-- name: Set facts
-  set_fact:
-    dummy: yes
+- block:
+
+    - name: Clone Git Repository
+      git:
+        accept_hostkey: yes
+        repo: '{{ drupal.src.git.repository }}'
+        dest: '{{ webRoot }}'
+        force: yes
+        version: '{{ drupal.src.git.branch|default(omit) }}'
+      become: no
+
+    - name: Create Git Hook for commit message
+      copy:
+        content: |
+          #!/bin/sh
+          echo "[ci skip]" >>$1
+        dest: '{{ webRoot }}/.git/hooks/prepare-commit-msg'
+        mode: 0777
+
+  tags:
+    - deploy
diff --git a/tasks/collect_config/prepare/gitflow.yml b/tasks/collect_config/prepare/gitflow.yml
index ec33197..dfaf6a9 100644
--- a/tasks/collect_config/prepare/gitflow.yml
+++ b/tasks/collect_config/prepare/gitflow.yml
@@ -3,22 +3,7 @@
 
 - block:
 
-    - name: Clone Git Repository
-      git:
-        accept_hostkey: yes
-        repo: '{{ drupal.src.git.repository }}'
-        dest: '{{ webRoot }}'
-        force: yes
-        version: '{{ drupal.src.git.branch|default(omit) }}'
-      become: no
-
-    - name: Create Git Hook for commit message
-      copy:
-        content: |
-          #!/bin/sh
-          echo "[ci skip]" >>$1
-        dest: '{{ webRoot }}/.git/hooks/prepare-commit-msg'
-        mode: 0777
+    - include_tasks: git.yml
 
     - name: Start Hotfix
       shell: git {{ item }}
-- 
GitLab