forked from phuang/ibus
-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
You can copy this file to .git/hooks/post-merge with the file permission '0755'. This script is useful not to commit invalid commit IDs every time and leave a temporary version(1.5.00) in source files when a release is bumped. Unfortunately .git/hooks/pre-merge-commit does not run for git merge fast-forwarding and I use post-merge instead as a workaround but post-merge succeeds the last merge so need to run git reset --hard if this script outputs warnings.
- Loading branch information
Showing
2 changed files
with
85 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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 |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#!/bin/sh | ||
# vim:set et sts=4 sw=4: | ||
# -*- coding: utf-8 -*- | ||
# | ||
# ibus - The Input Bus | ||
# | ||
# Copyright (c) 2010-2023 Takao Fujiwara <takao.fujiwara1@gmail.com> | ||
# | ||
# This library is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU Lesser General Public | ||
# License as published by the Free Software Foundation; either | ||
# version 2.1 of the License, or (at your option) any later version. | ||
# | ||
# This library is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
# Lesser General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Lesser General Public | ||
# License along with this library; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 | ||
# USA | ||
|
||
# You can copy this file to .git/hooks/post-merge with the file permission | ||
# '0755'. | ||
# This script is useful not to commit invalid commit IDs every time and | ||
# leave a temporary version(1.5.00) in source files when a release is | ||
# bumped. | ||
# Unfortunately .git/hooks/pre-merge-commit does not run for git merge | ||
# fast-forwarding and I use post-merge instead as a workaround | ||
# but post-merge succeed the last merge so need to run git reset --hard | ||
# if this script outputs warnings. | ||
|
||
REPO="ibus/ibus" | ||
TMP_VER="1.5.00" | ||
|
||
export GIT_PAGER=cat | ||
|
||
echo -e "\033[37;1mIBus post-merge\033[0m" | ||
|
||
check_commit_message() | ||
{ | ||
ID=$1 | ||
# Check files in the current branch only but not cached commits | ||
git log --pretty=oneline | grep -q "$ID" || { | ||
echo >&2 "Invalid commit ID: $ID" | ||
exit 1 | ||
} | ||
} | ||
|
||
THIS_FILE="$0" | ||
diff $THIS_FILE .github/hooks/$(basename $THIS_FILE) || { | ||
echo >&2 "$THIS_FILE is older than .github/hooks/$(basename $THIS_FILE)" | ||
exit 1 | ||
} | ||
|
||
test "" = "$(git log --pretty=email HEAD^...HEAD | | ||
grep '^Signed-off-by: ' | | ||
sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { | ||
echo >&2 Duplicate Signed-off-by lines. | ||
exit 1 | ||
} | ||
|
||
for ID in $(git log --pretty=email HEAD~100...HEAD | | ||
grep '^Fixes: ' | awk '{print $2}') | ||
do | ||
echo "$ID" | grep -q "^http" && { | ||
echo $ID | grep -q "$REPO/commit/" && { | ||
ID=$(basename $ID) | ||
check_commit_message $ID | ||
} || : | ||
} || { | ||
check_commit_message $ID | ||
} | ||
done | ||
|
||
git log --pretty=email HEAD^...HEAD | grep -q "^Subject: \[PATCH\] Release" && { | ||
FILES=$(grep "Since: $TMP_VER" $(git ls-files)) | ||
if test x"$FILES" != x ; then | ||
echo >&2 "You need to replace $TMP_VER with the releasing version" | ||
echo >&2 "$FILES" | ||
exit 1 | ||
fi | ||
} || : |