summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2023-09-16 14:49:21 -0400
committerMalfurious <m@lfurio.us>2023-09-16 14:49:21 -0400
commitfcf7dc53547554507ed0fe76acd78d1ac0456d9e (patch)
tree51121c2fa24f1f3e0be004c83ae2fa47866c3a81
parent0b329d20c64502e3a9e932590f7872e09167d001 (diff)
downloadsrcnode-fcf7dc53547554507ed0fe76acd78d1ac0456d9e.tar.gz
srcnode-fcf7dc53547554507ed0fe76acd78d1ac0456d9e.zip
gitolite: Fix bug in default branch push trigger
Since it is now allowed to remove the remote default branch, this script needs to handle cases where there are no branches following a push. In this case, the `git symbolic-ref` command will fail, and we return our standard warning for when HEAD is dangling. Signed-off-by: Malfurious <m@lfurio.us>
-rwxr-xr-xgitolite/dotfiles/local/triggers/push3
1 files changed, 1 insertions, 2 deletions
diff --git a/gitolite/dotfiles/local/triggers/push b/gitolite/dotfiles/local/triggers/push
index 7a3cb56..2c5e060 100755
--- a/gitolite/dotfiles/local/triggers/push
+++ b/gitolite/dotfiles/local/triggers/push
@@ -7,8 +7,7 @@ head=$(git symbolic-ref HEAD)
if ! [ -f "$head" ]; then
set -- refs/heads/*
- if [ "$#" -eq 1 ]; then
- git symbolic-ref HEAD "$1"
+ if [ $# -eq 1 ] && git symbolic-ref HEAD "$1" >/dev/null 2>&1; then
echo "NOTICE: Default branch set to $1" >&2
else
echo "WARNING: The default branch is $head, but no such branch exists" >&2