From 1225cf17d153e3bee7ef58da47ef38b2e32b8b75 Mon Sep 17 00:00:00 2001
From: Malfurious <m@lfurio.us>
Date: Mon, 11 Mar 2024 09:49:23 -0400
Subject: gitolite: Fix bug in post git trigger branch detection

The previous version fails to handle nested branch names containing
slashes.  For example, if pushing a single new branch named
`feat/example`, the script would set HEAD to `feat` and remain dangling.

Signed-off-by: Malfurious <m@lfurio.us>
---
 gitolite/dotfiles/local/triggers/push | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'gitolite/dotfiles/local/triggers')

diff --git a/gitolite/dotfiles/local/triggers/push b/gitolite/dotfiles/local/triggers/push
index 2c5e060..4a23583 100755
--- a/gitolite/dotfiles/local/triggers/push
+++ b/gitolite/dotfiles/local/triggers/push
@@ -6,7 +6,7 @@ cd "$GL_REPO_BASE/$2.git"
 head=$(git symbolic-ref HEAD)
 
 if ! [ -f "$head" ]; then
-    set -- refs/heads/*
+    set -- $(find refs/heads -type f)
     if [ $# -eq 1 ] && git symbolic-ref HEAD "$1" >/dev/null 2>&1; then
         echo "NOTICE: Default branch set to $1" >&2
     else
-- 
cgit v1.2.3