From 0213949276f9bd4ab33641f3988df225fc391b06 Mon Sep 17 00:00:00 2001 From: Ulrich Müller Date: Sat, 27 Feb 2021 14:44:32 +0100 Subject: local/update-06-copyright: Check only commits unreachable from any refs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes: https://bugs.gentoo.org/772926 Signed-off-by: Ulrich Müller Signed-off-by: Michał Górny --- local/tests/update-06-copyright.sh | 8 +++++++- local/update-06-copyright | 21 ++++++++++----------- 2 files changed, 17 insertions(+), 12 deletions(-) (limited to 'local') diff --git a/local/tests/update-06-copyright.sh b/local/tests/update-06-copyright.sh index 83b56c1..fcdeba5 100755 --- a/local/tests/update-06-copyright.sh +++ b/local/tests/update-06-copyright.sh @@ -1,7 +1,7 @@ #!/bin/bash # gentoo-infra: infra/githooks.git:tests/update-06-copyright.sh # Tests for update-06-copyright hook -# 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 . "${BASH_SOURCE%/*}"/lib.sh @@ -377,6 +377,12 @@ git checkout --orphan test-branch -q git commit --allow-empty -m "Commit without sign-off" -q test_branch_failure test-branch "${FAIL_NO_SIGNOFF}" +tbegin "New tag on independent branch" +git checkout --orphan test-branch -q +git commit --allow-empty -m "A commit" -q +git tag test-tag +test_tag_success test-tag + tbegin "Branch removal" test_branch_removal 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