Skip to content

Commit 76cd9bd

Browse files
rascalDanDan Goodliffe
andauthored
git-psykorebase: determine branch names with bash pattern substitution (#1073)
Co-authored-by: Dan Goodliffe <[email protected]>
1 parent f95e339 commit 76cd9bd

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

bin/git-psykorebase

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,13 @@ fi
5050

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

59-
SECONDARY_BRANCH=$1
60-
PRIMARY_BRANCH=$2
61-
6260
echo "Continuing rebasing of $SECONDARY_BRANCH on top of $PRIMARY_BRANCH"
6361
git commit || exit 51
6462
git branch -d "${SECONDARY_BRANCH}" || exit 52

0 commit comments

Comments
 (0)