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

Merge: put log tags into commits #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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: 7 additions & 1 deletion linux-stable.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ GRN="\033[01;32m"
RED="\033[01;31m"
RST="\033[0m"
YLW="\033[01;33m"
branch=$(git branch | grep \* | cut -d ' ' -f2)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git rev-parse --abbrev-ref HEAD is a cleaner way to do this



# Alias for echo to handle escape codes like colors
Expand Down Expand Up @@ -232,6 +233,9 @@ function generate_versions() {
echo
}

function tag_logs() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this!

git log --oneline --pretty=format:' %s' v${CURRENT_VERSION}..v${TARGET_VERSION}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v${CURRENT_VERSION}..v${TARGET_VERSION} = ${RANGE}

}

function update_to_target_version() {
case ${UPDATE_METHOD} in
Expand All @@ -245,12 +249,14 @@ git add . && git cherry-pick --continue"
fi ;;

"merge")
if ! GIT_MERGE_VERBOSITY=1 git merge --no-edit "v${TARGET_VERSION}"; then
if ! GIT_MERGE_VERBOSITY=1 git merge --edit -m "Merge ${TARGET_VERSION} into ${branch}" -m "Changes in ${TARGET_VERSION}: ($(git status | grep commits | cut -d ' ' -f8-9 | head -n1 | sed 's/commits./commits/'))" -m "$(tag_logs)" "v${TARGET_VERSION}" --no-edit; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kill the boilerplate (this exact same message is used in both places) and make a function like in my own script (create_merge_message, append_conflicts).

The git aliases can be viewed here for translation.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didn't check your personal scripts before, i just saw your commits on als repo xD, almost exact same
thanks

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah didn't expect you to :P if you feel like adapting it for here, by all means feel free!

die "Merge needs manual intervention!

Resolve conflicts then run git merge --continue!"
else
header "${TARGET_VERSION} MERGED CLEANLY!" "${GRN}"
git commit -q --amend -m "Merge ${TARGET_VERSION} into ${branch}" -m "Changes in ${TARGET_VERSION}: ($(git status | grep commits | cut -d ' ' -f8-9 | head -n1 | sed 's/commits./commits/'))" -m "$(tag_logs)" --no-edit

fi ;;
esac
}
Expand Down