From e763361a3a10f6bd844aeef9f2b3f23fdb7e789c Mon Sep 17 00:00:00 2001
From: Luca Bilke <luca@bil.ke>
Date: Wed, 9 Oct 2024 15:21:39 +0200
Subject: [PATCH] lazygit: fix autotagging keybind

---
 common/.config/lazygit/config.yml | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/common/.config/lazygit/config.yml b/common/.config/lazygit/config.yml
index 4cc1816b..54efedf9 100644
--- a/common/.config/lazygit/config.yml
+++ b/common/.config/lazygit/config.yml
@@ -55,7 +55,13 @@ customCommands:
     description: "prune local branches that have been merged to main/master"
   - key: "<c-t>"
     context: "global"
-    command: "tag=$(date +%Y).$(date +%m | sed 's/^0//').$(($(git tag --sort=-v:refname | grep ^$MAJOR.$MINOR | head -n 1 | cut -d . -f 3) + 1)); git tag -m '' $tag; git push {{ .SelectedRemote.Name }} $tag;"
+    command: |
+      major=$(date +%Y)
+      minor=$(date +%m | sed 's/^0//')
+      patch=$(($(git tag --sort=-v:refname | grep ^$major\.$minor | head -n 1 | cut -d . -f 3) + 1))
+      tag="${major}.${minor}.${patch}"
+      git tag -m '' "$tag"
+      git push {{ .SelectedRemote.Name }} "$tag"
     description: "Create and push a tag based off the date"
     loadingText: "Tagging/Pushing..."
   - key: "<c-v>"