Compare commits
1 commit
d6709cc2cb
...
2db32b20dd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2db32b20dd |
1 changed files with 8 additions and 3 deletions
|
|
@ -264,10 +264,15 @@ export FORGE_REMOTE
|
|||
log "forge remote: ${FORGE_REMOTE}"
|
||||
|
||||
# Generate unique branch name per attempt to avoid collision with failed attempts
|
||||
# Only apply when not in recovery mode (RECOVERY_MODE branch is already set from existing PR)
|
||||
# First attempt: fix/issue-N, subsequent: fix/issue-N-1, fix/issue-N-2, etc.
|
||||
ATTEMPT=$(git ls-remote --heads "$FORGE_REMOTE" "fix/issue-${ISSUE}*" 2>/dev/null | wc -l)
|
||||
if [ "$ATTEMPT" -gt 0 ]; then
|
||||
BRANCH="fix/issue-${ISSUE}-${ATTEMPT}"
|
||||
if [ "$RECOVERY_MODE" = false ]; then
|
||||
# Count only branches matching fix/issue-N, fix/issue-N-1, fix/issue-N-2, etc. (exact prefix match)
|
||||
ATTEMPT=$(git ls-remote --heads "$FORGE_REMOTE" "refs/heads/fix/issue-${ISSUE}" 2>/dev/null | grep -c "refs/heads/fix/issue-${ISSUE}$" || echo 0)
|
||||
ATTEMPT=$((ATTEMPT + $(git ls-remote --heads "$FORGE_REMOTE" "refs/heads/fix/issue-${ISSUE}-*" 2>/dev/null | wc -l)))
|
||||
if [ "$ATTEMPT" -gt 0 ]; then
|
||||
BRANCH="fix/issue-${ISSUE}-${ATTEMPT}"
|
||||
fi
|
||||
fi
|
||||
log "using branch: ${BRANCH}"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue