From 5b28e2da8b2072798b996462c44831c06714fe3d Mon Sep 17 00:00:00 2001
From: Manuel Thalmann <m@nuth.ch>
Date: Fri, 13 Sep 2024 15:08:18 +0200
Subject: [PATCH] Configure `git` using PowerShell script

---
 scripts/Common/Software/git/main.fish | 78 +--------------------------
 1 file changed, 1 insertion(+), 77 deletions(-)

diff --git a/scripts/Common/Software/git/main.fish b/scripts/Common/Software/git/main.fish
index 47510c3f..48ba366d 100755
--- a/scripts/Common/Software/git/main.fish
+++ b/scripts/Common/Software/git/main.fish
@@ -3,84 +3,8 @@ begin
     set -l dir (status dirname)
     source "$(status dirname)/../../Scripts/software.fish"
 
-    function configureGit -S -V dir -a name
-        source "$dir/../../Scripts/config.fish"
-        set -l root "valhalla"
-        set -l user
-        set -l configArgs
-
-        function setConfig -S
-            sudo -u "$user" git config $configArgs $argv
-        end
-
-        if [ -z "$name" ]
-            set user "root"
-            set configArgs "--system"
-        else
-            set root "$root.users.$name"
-            set user "$name"
-            set configArgs "--global"
-            set -l displayName "$root.displayName"
-            set -l mailAddress "$root.mailAddress"
-
-            if isSet "$displayName"
-                setConfig user.name (getConfig "$displayName")
-            end
-
-            if isSet "$mailAddress"
-                setConfig user.email (getConfig "$mailAddress")
-            end
-        end
-
-        set -l branch "$root.git.defaultBranch"
-
-        if isSet "$branch"
-            setConfig init.defaultBranch (getConfig "$branch")
-        end
-
-        begin # Git Flow
-            set -l dir (mktemp -d)
-
-            begin
-                set -l key "$root.git.flow"
-                set -l mainKey "$key.mainBranch"
-                set -l devKey "$key.devBranch"
-
-                git -C "$dir" init
-                git -C "$dir" commit --allow-empty -m "Initial commit" > /dev/null
-                git -C "$dir" branch master || true &> /dev/null
-                git -C "$dir" branch main || true &> /dev/null
-                git -C "$dir" branch dev || true &> /dev/null
-                yes "" | git -C "$dir" flow init &> /dev/null
-
-                if isSet "$mainKey"
-                    sudo git -C "$dir" flow config set $configArgs master (getConfig "$mainKey") > /dev/null
-                else
-                    true
-                end
-
-                if isSet "$devKey"
-                    sudo git -C "$dir" flow config set $configArgs develop (getConfig "$devKey") > /dev/null
-                else
-                    true
-                end
-            end
-
-            rm -rf "$dir"
-        end
-
-        begin # Aliases
-            set -l key "$root.git.aliases"
-            set -l aliases (getConfig "$key" --json)
-
-            for name in (echo "$aliases" | jq 'keys[]' --raw-output0 | string split0)
-                setConfig "alias.$name" (getConfig "$key.$name")
-            end
-        end
-    end
-
     function configureSW -S -V dir
-        configureGit
+        pwsh "$dir/Manage.ps1" Configure
     end
 
     function userConfig -S -V dir -a name