diff options
Diffstat (limited to 'local/update-04-utf8')
-rwxr-xr-x | local/update-04-utf8 | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/local/update-04-utf8 b/local/update-04-utf8 index 0ad8b5b..1b18834 100755 --- a/local/update-04-utf8 +++ b/local/update-04-utf8 @@ -1,6 +1,6 @@ #!/bin/bash # gentoo-infra: infra/githooks.git:update-04-utf8 -# Copyright 2017 Gentoo Foundation +# Copyright 2017-2021 Michał Górny and others # Distributed under the terms of the GNU General Public License v2 or later # Author: Michał Górny <mgorny@gentoo.org> @@ -15,11 +15,13 @@ export LC_MESSAGES=C zeros=0000000000000000000000000000000000000000 # branch removal [[ ${newrev} == "${zeros}" ]] && exit 0 -# new branch; try to find a merge base with master -if [[ ${oldrev} == "${zeros}" && ${refname} != refs/heads/master ]]; then - mergebase=$(git merge-base refs/heads/master "${newrev}") - [[ -n ${mergebase} ]] && oldrev=${mergebase} - [[ -z ${mergebase} ]] && echo "WARNING: No common commits with master!" +rev_list_arg="${oldrev}..${newrev}" +exec 10</dev/null +# new branch; check all commits that are reachable from ${newrev} +# but not reachable from any existing ref in refs/ +if [[ ${oldrev} == "${zeros}" ]]; then + rev_list_arg="${newrev}" + exec 10< <(git rev-parse --not --exclude="${refname}" --all) fi ret=0 @@ -31,6 +33,6 @@ while read commithash; do echo "Commit ${commithash} contains invalid UTF-8 in the commit metadata" ret=1 fi -done < <(git rev-list "${oldrev}..${newrev}") +done < <(git rev-list "${rev_list_arg}" --stdin <&10) exit ${ret} |