From 27feb580ad312ae100b752f4043170c5c2e23e29 Mon Sep 17 00:00:00 2001 From: Adek Maulana Date: Sat, 28 Apr 2018 11:17:24 +0700 Subject: [PATCH] Merge: put log tags into commits Instead of 'This is {tags} the stable released' this will input tag logs into merge-commits. * but not sure this will works on others, but mine works well. --- linux-stable.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/linux-stable.sh b/linux-stable.sh index eb52665..24a9dcb 100755 --- a/linux-stable.sh +++ b/linux-stable.sh @@ -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) # Alias for echo to handle escape codes like colors @@ -232,6 +233,9 @@ function generate_versions() { echo } +function tag_logs() { + git log --oneline --pretty=format:' %s' v${CURRENT_VERSION}..v${TARGET_VERSION} +} function update_to_target_version() { case ${UPDATE_METHOD} in @@ -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 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 }