aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xlocal/update-03-filename9
-rwxr-xr-xlocal/update-04-utf816
-rwxr-xr-xlocal/update-05-manifest9
3 files changed, 13 insertions, 21 deletions
diff --git a/local/update-03-filename b/local/update-03-filename
index 64e014b..63ef270 100755
--- a/local/update-03-filename
+++ b/local/update-03-filename
@@ -1,6 +1,6 @@
#!/bin/bash
# gentoo-infra: infra/githooks.git:update-03-filename
-# Copyright 2015-2017 Gentoo Foundation
+# Copyright 2015-2021 Ulrich Müller and others
# Distributed under the terms of the GNU General Public License v2 or later
# Author: Ulrich Müller <ulm@gentoo.org>
@@ -16,12 +16,7 @@ newrev=$3
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!"
-fi
+# no need to check for new branch because we skip non-master commits above
# Filenames must contain only the characters [A-Za-z0-9._+-] and must
# not begin with a dot, a hyphen, or a plus sign.
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}
diff --git a/local/update-05-manifest b/local/update-05-manifest
index 8ae0bc4..94fc593 100755
--- a/local/update-05-manifest
+++ b/local/update-05-manifest
@@ -1,6 +1,6 @@
#!/bin/bash
# gentoo-infra: infra/githooks.git:update-05-manifest
-# 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>
@@ -18,12 +18,7 @@ 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!"
-fi
+# no need to check for new branch because we skip non-master commits above
ret=0
while read commithash; do