summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'local/update-06-copyright')
-rwxr-xr-xlocal/update-06-copyright21
1 files changed, 10 insertions, 11 deletions
diff --git a/local/update-06-copyright b/local/update-06-copyright
index 4fe653d..01f5454 100755
--- a/local/update-06-copyright
+++ b/local/update-06-copyright
@@ -1,7 +1,7 @@
#!/bin/bash
# gentoo-infra: infra/githooks.git:update-06-copyright
# Verify that GCO sign-off is present in commit messages
-# Copyright 2018 Michał Górny
+# Copyright 2018-2021 Michał Górny and others
# Distributed under the terms of the GNU General Public License v2 or later
# Disable filename expansion
@@ -71,18 +71,17 @@ ret=0
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
rev_list_arg="${oldrev}..${newrev}"
-# new and no common commit? gotta check them all
-[[ ${oldrev} == "${zeros}" ]] && rev_list_arg="${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
while read -r commithash; do
- # verify that the commit message contains Signed-off-by
+ # verify that the commit message contains Signed-off-by
signoff=no
committer=$(git show -q --pretty=format:'%ce' "${commithash}")
@@ -165,7 +164,7 @@ while read -r commithash; do
echo " last found: ${realname}"
ret=1;;
esac
-done < <(git rev-list "${rev_list_arg}")
+done < <(git rev-list "${rev_list_arg}" --stdin <&10)
if [[ ${ret} == 1 ]]; then
echo