aosp-merger: Improve merge commit message
* Merge and commit separately, to get newline between commit content and Change-Id * Install prepare-commit-msg git hook, for nicer conflict messages https://gist.github.com/mikeNG/e55ef8e7a1e5cd596a950386503054fd/ Change-Id: I97370b352ccf4f146b4b6ea89af75e032fb13730
This commit is contained in:
@@ -32,6 +32,8 @@ readonly vars_path="${script_path}/../vars"
|
|||||||
|
|
||||||
source "${vars_path}/common"
|
source "${vars_path}/common"
|
||||||
|
|
||||||
|
readonly hook="${script_path}/prepare-commit-msg"
|
||||||
|
|
||||||
TOP="${script_path}/../../.."
|
TOP="${script_path}/../../.."
|
||||||
BRANCH="${calyxos_branch}"
|
BRANCH="${calyxos_branch}"
|
||||||
STAGINGBRANCH="staging/${BRANCH}_${OPERATION}-${NEWTAG}"
|
STAGINGBRANCH="staging/${BRANCH}_${OPERATION}-${NEWTAG}"
|
||||||
@@ -40,6 +42,9 @@ cd "${TOP}/${PROJECTPATH}"
|
|||||||
repo start "${STAGINGBRANCH}" .
|
repo start "${STAGINGBRANCH}" .
|
||||||
git fetch -q --tags aosp "${NEWTAG}"
|
git fetch -q --tags aosp "${NEWTAG}"
|
||||||
|
|
||||||
|
[[ ! -e .git/hooks/prepare-commit-msg ]] && cp "${hook}" .git/hooks/
|
||||||
|
chmod +x .git/hooks/prepare-commit-msg
|
||||||
|
|
||||||
PROJECTOPERATION="${OPERATION}"
|
PROJECTOPERATION="${OPERATION}"
|
||||||
|
|
||||||
# Check if we've actually changed anything before attempting to merge
|
# Check if we've actually changed anything before attempting to merge
|
||||||
@@ -67,7 +72,7 @@ fi
|
|||||||
|
|
||||||
if [[ "${PROJECTOPERATION}" == "merge" ]]; then
|
if [[ "${PROJECTOPERATION}" == "merge" ]]; then
|
||||||
echo "#### Merging ${NEWTAG} into ${PROJECTPATH} ####"
|
echo "#### Merging ${NEWTAG} into ${PROJECTPATH} ####"
|
||||||
git merge --no-edit --log "${NEWTAG}"
|
git merge --no-commit --log "${NEWTAG}" && git commit --no-edit
|
||||||
elif [[ "${PROJECTOPERATION}" == "rebase" ]]; then
|
elif [[ "${PROJECTOPERATION}" == "rebase" ]]; then
|
||||||
echo "#### Rebasing ${PROJECTPATH} onto ${NEWTAG} ####"
|
echo "#### Rebasing ${PROJECTPATH} onto ${NEWTAG} ####"
|
||||||
git rebase --onto "${NEWTAG}" "${OLDTAG}"
|
git rebase --onto "${NEWTAG}" "${OLDTAG}"
|
||||||
|
|||||||
14
aosp-merger/prepare-commit-msg
Normal file
14
aosp-merger/prepare-commit-msg
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
case "$2,$3" in
|
||||||
|
merge,)
|
||||||
|
if grep -q "# It looks like you may be committing a merge." "$1"; then
|
||||||
|
sed -i -e '/# ------------------------ >8 ------------------------/,+3d' "$1"
|
||||||
|
/usr/bin/perl -i.bak -ne 's/^#// if /^# Conflicts/ .. /^#\R/; print' "$1"
|
||||||
|
sed -i '/ It looks like you may be committing a merge./i # ------------------------ >8 ------------------------' "$1"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
Reference in New Issue
Block a user