-
Notifications
You must be signed in to change notification settings - Fork 1
LT Rebase Merge: Deal with failure better, Shell Check fixes #23
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
Open
PlaidCat
wants to merge
3
commits into
mainline
Choose a base branch
from
{jmaple}_lt_rebuild_merge_fixes
base: mainline
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,30 +12,30 @@ if [ -z "$PR_BRANCH" ] || [ -z "$TARGET_BRANCH" ]; then | |
fi | ||
|
||
# Check if all branches exist | ||
git show-ref --verify --quiet refs/heads/$PR_BRANCH | ||
git show-ref --verify --quiet refs/heads/"${PR_BRANCH}" | ||
if [ $? -ne 0 ]; then | ||
echo "Branch ${PR_BRANCH} does not exist." | ||
exit 1 | ||
fi | ||
|
||
git show-ref --verify --quiet refs/heads/$TARGET_BRANCH | ||
git show-ref --verify --quiet refs/heads/"${TARGET_BRANCH}" | ||
if [ $? -ne 0 ]; then | ||
echo "Branch ${TARGET_BRANCH} does not exist." | ||
exit 1 | ||
fi | ||
|
||
git show-ref --verify --quiet refs/heads/$NEXT_BRANCH | ||
git show-ref --verify --quiet refs/heads/"${NEXT_BRANCH}" | ||
if [ $? -ne 0 ] ; then | ||
echo "Branch ${NEXT_BRANCH} does not exist." | ||
exit 1 | ||
fi | ||
|
||
|
||
#collect all static data fire before making alterations to the local and remote repositories | ||
PAST_VERSION=$(git describe --tags --abbrev=0 $TARGET_BRANCH | awk -F '-' '{print $2}') | ||
PAST_VERSION=$(git describe --tags --abbrev=0 "${TARGET_BRANCH}" | awk -F '-' '{print $2}') | ||
if [ -z "$PAST_VERSION" ]; then | ||
echo "Failed to get a CIQ Tag from ${TARGET_BRANCH}." | ||
echo "LastTag: $(git describe --tags --abbrev=0 $TARGET_BRANCH)" | ||
echo "LastTag: $(git describe --tags --abbrev=0 "${TARGET_BRANCH}")" | ||
exit 1 | ||
fi | ||
# Check if PAST_VERSION matches the regex | ||
|
@@ -48,10 +48,10 @@ PAST_VERSION_BRANCH="ciq-${PAST_VERSION}" | |
echo "PAST_VERSION: $PAST_VERSION" | ||
echo "PAST_VERSION_BRANCH: $PAST_VERSION_BRANCH" | ||
|
||
NEW_GKH_TAG=$(git describe --tags --abbrev=0 $PR_BRANCH | sed 's/^.//g') | ||
NEW_GKH_TAG=$(git describe --tags --abbrev=0 "${PR_BRANCH}" | sed 's/^.//g') | ||
if [ -z "$NEW_GKH_TAG" ]; then | ||
echo "Failed to get a GKH Tag from ${PR_BRANCH}." | ||
echo "LastTag: $(git describe --tags --abbrev=0 $PR_BRANCH)" | ||
echo "LastTag: $(git describe --tags --abbrev=0 "${PR_BRANCH}")" | ||
exit 1 | ||
fi | ||
# Check if NEW_GKH_TAG matches the regex | ||
|
@@ -60,89 +60,116 @@ if ! [[ $NEW_GKH_TAG =~ $NVR_REGEX ]]; then # check if NEW_GKH_TAG matches the r | |
exit 1 | ||
fi | ||
NEW_CIQ_TAG="ciq_kernel-${NEW_GKH_TAG}-1" | ||
|
||
|
||
# merge PR branch into next branch | ||
set +x | ||
|
||
echo "Commands expected to run (This is in the event it fails during the run)" | ||
echo "git checkout \"${NEXT_BRANCH}\"" | ||
echo "git pull origin \"${NEXT_BRANCH}\"" | ||
echo "git merge --ff-only \"${PR_BRANCH}\"" | ||
echo "git push origin \"${NEXT_BRANCH}\"" | ||
echo "git branch -m \"${TARGET_BRANCH}\" \"${PAST_VERSION_BRANCH}\"" | ||
echo "git push origin :\"${TARGET_BRANCH}\" \"${PAST_VERSION_BRANCH}\"" | ||
echo "git push origin -u \"${PAST_VERSION_BRANCH}\"" | ||
echo "git branch -m \"${NEXT_BRANCH}\" \"${TARGET_BRANCH}\"" | ||
echo "git push origin :\"${NEXT_BRANCH}\" \"${TARGET_BRANCH}\"" | ||
echo "git push origin -u \"${TARGET_BRANCH}\"" | ||
echo "git tag \"${NEW_CIQ_TAG}\" \"${TARGET_BRANCH}\"" | ||
echo "git push origin \"${NEW_CIQ_TAG}\"" | ||
|
||
echo "git checkout $NEXT_BRANCH" | ||
git checkout $NEXT_BRANCH | ||
git checkout "${NEXT_BRANCH}" | ||
if [ $? -ne 0 ]; then | ||
echo "Failed to checkout ${NEXT_BRANCH}." | ||
exit 1 | ||
fi | ||
|
||
echo "git pull origin $NEXT_BRANCH" | ||
git pull origin $NEXT_BRANCH | ||
git pull origin "${NEXT_BRANCH}" | ||
if [ $? -ne 0 ]; then | ||
echo "Failed to pull ${NEXT_BRANCH}." | ||
exit 1 | ||
fi | ||
|
||
Comment on lines
+81
to
93
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [nitpick] The repeated pattern of Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||
echo "git merge --ff-only $PR_BRANCH" | ||
git merge --ff-only $PR_BRANCH | ||
echo "git merge --ff-only ${PR_BRANCH}" | ||
git merge --ff-only "${PR_BRANCH}" | ||
if [ $? -ne 0 ]; then | ||
echo "Failed to merge ${PR_BRANCH} into ${NEXT_BRANCH}." | ||
exit 1 | ||
fi | ||
|
||
echo "git push origin $NEXT_BRANCH" | ||
git push origin $NEXT_BRANCH | ||
git push origin "${NEXT_BRANCH}" | ||
if [ $? -ne 0 ]; then | ||
echo "Failed to push ${NEXT_BRANCH}." | ||
exit 1 | ||
fi | ||
|
||
echo "Delete PR branch ${PR_BRANCH} locally and remotely" | ||
PlaidCat marked this conversation as resolved.
Show resolved
Hide resolved
|
||
echo "git push origin :${PR_BRANCH}" | ||
git push origin :"${PR_BRANCH}" | ||
if [ $? -ne 0 ]; then | ||
echo "Failed to delete ${PR_BRANCH} remotely." | ||
exit 1 | ||
fi | ||
git branch -d "${PR_BRANCH}" | ||
if [ $? -ne 0 ]; then | ||
echo "Failed to delete ${PR_BRANCH} locally." | ||
exit 1 | ||
fi | ||
|
||
|
||
echo "git branch -m $TARGET_BRANCH $PAST_VERSION_BRANCH" | ||
git branch -m $TARGET_BRANCH $PAST_VERSION_BRANCH | ||
git branch -m "${TARGET_BRANCH}" "${PAST_VERSION_BRANCH}" | ||
if [ $? -ne 0 ]; then | ||
echo "Failed to rename ${TARGET_BRANCH} to ${PAST_VERSION_BRANCH}." | ||
exit 1 | ||
fi | ||
|
||
echo "git push origin :$TARGET_BRANCH $PAST_VERSION_BRANCH" | ||
git push origin :$TARGET_BRANCH $PAST_VERSION_BRANCH | ||
git push origin :"${TARGET_BRANCH}" "${PAST_VERSION_BRANCH}" | ||
if [ $? -ne 0 ]; then | ||
echo "Failed to delete ${TARGET_BRANCH}." | ||
exit 1 | ||
fi | ||
|
||
echo "git push origin -u $PAST_VERSION_BRANCH" | ||
git push origin -u $PAST_VERSION_BRANCH | ||
git push origin -u "${PAST_VERSION_BRANCH}" | ||
if [ $? -ne 0 ]; then | ||
echo "Failed to push ${PAST_VERSION_BRANCH}." | ||
exit 1 | ||
fi | ||
|
||
echo "git branch -m $NEXT_BRANCH $TARGET_BRANCH" | ||
git branch -m $NEXT_BRANCH $TARGET_BRANCH | ||
git branch -m "${NEXT_BRANCH}" "${TARGET_BRANCH}" | ||
if [ $? -ne 0 ]; then | ||
echo "Failed to rename ${NEXT_BRANCH} to ${TARGET_BRANCH}." | ||
exit 1 | ||
fi | ||
|
||
echo "git push origin :$NEXT_BRANCH $TARGET_BRANCH" | ||
git push origin :$NEXT_BRANCH $TARGET_BRANCH | ||
git push origin :"${NEXT_BRANCH}" "${TARGET_BRANCH}" | ||
if [ $? -ne 0 ]; then | ||
echo "Failed to delete ${NEXT_BRANCH}." | ||
exit 1 | ||
fi | ||
|
||
echo "git push origin -u $TARGET_BRANCH" | ||
git push origin -u $TARGET_BRANCH | ||
git push origin -u "${TARGET_BRANCH}" | ||
if [ $? -ne 0 ]; then | ||
echo "Failed to push ${TARGET_BRANCH}." | ||
exit 1 | ||
fi | ||
|
||
echo "git tag $NEW_CIQ_TAG $TARGET_BRANCH" | ||
git tag $NEW_CIQ_TAG $TARGET_BRANCH | ||
git tag "${NEW_CIQ_TAG}" "${TARGET_BRANCH}" | ||
if [ $? -ne 0 ]; then | ||
echo "Failed to tag ${TARGET_BRANCH} with ${NEW_CIQ_TAG}." | ||
exit 1 | ||
fi | ||
|
||
echo "git push origin $NEW_CIQ_TAG" | ||
git push origin $NEW_CIQ_TAG | ||
git push origin "${NEW_CIQ_TAG}" | ||
if [ $? -ne 0 ]; then | ||
echo "Failed to push ${NEW_CIQ_TAG}." | ||
exit 1 | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.