Skip to content

Commit

Permalink
feat: improve branch processing if a target branch doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesreffett committed Mar 1, 2024
1 parent a4d95d9 commit 5559d58
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions bin/git-tickets
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,23 @@ process_branch() {
local temp_branch="temp_${branch_name}_$$"
if $UPDATE_BRANCHES; then
git checkout "$branch_name" &> /dev/null
if [ $? -ne 0 ]; then
echo "Failed to checkout branch $branch_name" >&2
exit 1
fi
git pull origin "$branch_name" &> /dev/null
echo "$branch_name"
else
git fetch origin "$branch_name":"$temp_branch" &> /dev/null
if ! git rev-parse --verify "$temp_branch" &> /dev/null; then
echo "Failed to fetch and create temp branch for $branch_name" >&2
exit 1
fi
echo "$temp_branch"
fi
}


# Process the first branch
BRANCH1=$(process_branch "$BRANCH1")

Expand Down

0 comments on commit 5559d58

Please sign in to comment.