Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git-psykorebase: determine branch names with bash pattern substitution #1073

Merged
merged 1 commit into from
Sep 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions bin/git-psykorebase
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,13 @@ fi

if [[ "$CONTINUE" == "yes" ]]; then
TARGET_BRANCH=$(current_branch)
set "$(echo "$TARGET_BRANCH" | sed -e "s/-rebased-on-top-of-/\n/g")"
if [[ $# != 2 ]]; then
SECONDARY_BRANCH=${TARGET_BRANCH%"-rebased-on-top-of-"*}
PRIMARY_BRANCH=${TARGET_BRANCH#*"-rebased-on-top-of-"}
if [[ "${SECONDARY_BRANCH}-rebased-on-top-of-${PRIMARY_BRANCH}" != $TARGET_BRANCH ]]; then
echo "Couldn't continue rebasing on ${TARGET_BRANCH}"
exit 30 # Impossible to detect PRIMARY_BRANCH AND SECONDARY_BRANCH
fi

SECONDARY_BRANCH=$1
PRIMARY_BRANCH=$2

echo "Continuing rebasing of $SECONDARY_BRANCH on top of $PRIMARY_BRANCH"
git commit || exit 51
git branch -d "${SECONDARY_BRANCH}" || exit 52
Expand Down