From 8899266f88e2f3edec924911a8a6adfbcc526340 Mon Sep 17 00:00:00 2001 From: demenik Date: Tue, 2 Dec 2025 18:14:35 +0100 Subject: [PATCH] fix: Force TARGET_BRANCH to not be dev if BASE_BRANCH is dev --- home/shells/zsh/scripts/git-changes.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/home/shells/zsh/scripts/git-changes.sh b/home/shells/zsh/scripts/git-changes.sh index 33b6857..4a73ae8 100644 --- a/home/shells/zsh/scripts/git-changes.sh +++ b/home/shells/zsh/scripts/git-changes.sh @@ -1,8 +1,10 @@ #!/usr/bin/env bash +TARGET_BRANCH=${2:-$(git rev-parse --abbrev-ref HEAD)} + if [ -n "$1" ]; then BASE_BRANCH="$1" else - if git show-ref --verify --quiet refs/heads/dev; then + if [ "$TARGET_BRANCH" != "dev" ] && git show-ref --verify --quiet refs/heads/dev; then BASE_BRANCH="dev" elif git show-ref --verify --quiet refs/heads/main; then BASE_BRANCH="main" @@ -14,8 +16,6 @@ else fi fi -TARGET_BRANCH=${2:-$(git rev-parse --abbrev-ref HEAD)} - if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then echo "Error: Not a git repository." >&2 exit 1