From 26d8ff519c7895937e3f5c255e2cbcb57c8937d3 Mon Sep 17 00:00:00 2001 From: Lutz Reinhardt Date: Mon, 16 Feb 2026 16:13:06 +0000 Subject: [PATCH 01/13] add hooks configuration --- .pre-commit-config.yaml | 9 +++------ .pre-commit-hooks.yaml | 6 ++++++ 2 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 .pre-commit-hooks.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b7d181f..32eeba6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -35,10 +35,7 @@ repos: hooks: - id: shellcheck - - repo: local + - repo: ./.git + rev: HEAD hooks: - - id: reuse annotate - name: Check and fix copyright headers with reuse annotate - entry: ./scripts/run_reuse_annotate.sh - language: system - pass_filenames: false + - id: reuse-annotate diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml new file mode 100644 index 0000000..ecd6e34 --- /dev/null +++ b/.pre-commit-hooks.yaml @@ -0,0 +1,6 @@ +- id: reuse-annotate + name: Check and fix copyright headers with reuse annotate + entry: ./scripts/run_reuse_annotate.sh + language: system + pass_filenames: false + minimum_pre_commit_version: 3.2.0 From acfe0ba3ecc5b57140e68a301b2946a9bb6d60f5 Mon Sep 17 00:00:00 2001 From: Lutz Reinhardt Date: Mon, 16 Feb 2026 16:18:10 +0000 Subject: [PATCH 02/13] run hooks --- .pre-commit-config.yaml | 2 +- .pre-commit-hooks.yaml | 27 +++++++++++++++++++++------ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 32eeba6..7834ece 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -36,6 +36,6 @@ repos: - id: shellcheck - repo: ./.git - rev: HEAD + rev: 26d8ff519c7895937e3f5c255e2cbcb57c8937d3 hooks: - id: reuse-annotate diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index ecd6e34..d1f0bc3 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -1,6 +1,21 @@ -- id: reuse-annotate - name: Check and fix copyright headers with reuse annotate - entry: ./scripts/run_reuse_annotate.sh - language: system - pass_filenames: false - minimum_pre_commit_version: 3.2.0 +# ******************************************************************************* +# Copyright (c) 2026 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-FileCopyrightText: 2026 Contributors to the Eclipse Foundation +# SPDX-License-Identifier: Apache-2.0 +# ******************************************************************************* + +--- + - id: reuse-annotate + name: Check and fix copyright headers with reuse annotate + entry: ./scripts/run_reuse_annotate.sh + language: system + pass_filenames: false + minimum_pre_commit_version: 3.2.0 From b22cce25d68ff718378da9ffdd36dd77f160d2de Mon Sep 17 00:00:00 2001 From: Lutz Reinhardt Date: Mon, 16 Feb 2026 16:18:50 +0000 Subject: [PATCH 03/13] run hook --- scripts/run_reuse_annotate.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/run_reuse_annotate.sh b/scripts/run_reuse_annotate.sh index d0a1827..d45bb64 100755 --- a/scripts/run_reuse_annotate.sh +++ b/scripts/run_reuse_annotate.sh @@ -14,6 +14,8 @@ # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************* +# test + set -euxo pipefail SCRIPT_PATH=$(readlink -f "$0") From 6a14d1d40166a92a8b2b83ea39f793ebaa6ebe20 Mon Sep 17 00:00:00 2001 From: Lutz Reinhardt Date: Mon, 16 Feb 2026 16:19:10 +0000 Subject: [PATCH 04/13] remove test --- scripts/run_reuse_annotate.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/run_reuse_annotate.sh b/scripts/run_reuse_annotate.sh index d45bb64..d0a1827 100755 --- a/scripts/run_reuse_annotate.sh +++ b/scripts/run_reuse_annotate.sh @@ -14,8 +14,6 @@ # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************* -# test - set -euxo pipefail SCRIPT_PATH=$(readlink -f "$0") From 5dad6ed1765a52e9c9e74f8810119a27e7032d72 Mon Sep 17 00:00:00 2001 From: Lutz Reinhardt Date: Mon, 16 Feb 2026 16:47:30 +0000 Subject: [PATCH 05/13] move run_reuse_annotate.sh to pre_commit_hooks --- .pre-commit-config.yaml | 2 +- .pre-commit-hooks.yaml | 16 +--------------- .../run_reuse_annotate.sh | 0 3 files changed, 2 insertions(+), 16 deletions(-) rename {scripts => pre_commit_hooks}/run_reuse_annotate.sh (100%) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7834ece..ad35790 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -36,6 +36,6 @@ repos: - id: shellcheck - repo: ./.git - rev: 26d8ff519c7895937e3f5c255e2cbcb57c8937d3 + rev: cf803d9dcf981a3596c2691d3be48ff7f3a8dff2 hooks: - id: reuse-annotate diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index d1f0bc3..80345a3 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -1,21 +1,7 @@ -# ******************************************************************************* -# Copyright (c) 2026 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-FileCopyrightText: 2026 Contributors to the Eclipse Foundation -# SPDX-License-Identifier: Apache-2.0 -# ******************************************************************************* - --- - id: reuse-annotate name: Check and fix copyright headers with reuse annotate - entry: ./scripts/run_reuse_annotate.sh + entry: run_reuse_annotate.sh language: system pass_filenames: false minimum_pre_commit_version: 3.2.0 diff --git a/scripts/run_reuse_annotate.sh b/pre_commit_hooks/run_reuse_annotate.sh similarity index 100% rename from scripts/run_reuse_annotate.sh rename to pre_commit_hooks/run_reuse_annotate.sh From 03973d8e5b02d40aabadbd9fb2c925099d524975 Mon Sep 17 00:00:00 2001 From: Lutz Reinhardt Date: Mon, 16 Feb 2026 16:50:31 +0000 Subject: [PATCH 06/13] test changes --- .pre-commit-config.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ad35790..a2e262f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,6 +13,8 @@ # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************* +#test + repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # v6.0.0 From 758e4929ee5a6f767a1e11861f006d08cac1dd98 Mon Sep 17 00:00:00 2001 From: Lutz Reinhardt Date: Mon, 16 Feb 2026 16:51:15 +0000 Subject: [PATCH 07/13] use existing version --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a2e262f..3d4a86e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -38,6 +38,6 @@ repos: - id: shellcheck - repo: ./.git - rev: cf803d9dcf981a3596c2691d3be48ff7f3a8dff2 + rev: 03973d8e5b02d40aabadbd9fb2c925099d524975 hooks: - id: reuse-annotate From a0ce1f1af4b0a6b8c1567f42be26f8aec684eed2 Mon Sep 17 00:00:00 2001 From: Lutz Reinhardt Date: Mon, 16 Feb 2026 16:58:15 +0000 Subject: [PATCH 08/13] try unsupported_scripts language --- .pre-commit-config.yaml | 8 ++++---- .pre-commit-hooks.yaml | 4 ++-- {pre_commit_hooks => scripts}/run_reuse_annotate.sh | 0 3 files changed, 6 insertions(+), 6 deletions(-) rename {pre_commit_hooks => scripts}/run_reuse_annotate.sh (100%) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3d4a86e..957265c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -37,7 +37,7 @@ repos: hooks: - id: shellcheck - - repo: ./.git - rev: 03973d8e5b02d40aabadbd9fb2c925099d524975 - hooks: - - id: reuse-annotate + # - repo: ./.git + # rev: 03973d8e5b02d40aabadbd9fb2c925099d524975 + # hooks: + # - id: reuse-annotate diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 80345a3..fed3c4a 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -1,7 +1,7 @@ --- - id: reuse-annotate name: Check and fix copyright headers with reuse annotate - entry: run_reuse_annotate.sh - language: system + entry: scripts/run_reuse_annotate.sh + language: unsupported_script pass_filenames: false minimum_pre_commit_version: 3.2.0 diff --git a/pre_commit_hooks/run_reuse_annotate.sh b/scripts/run_reuse_annotate.sh similarity index 100% rename from pre_commit_hooks/run_reuse_annotate.sh rename to scripts/run_reuse_annotate.sh From 0a9e1199e37cfab4d53ba6cc110ef81af00dad1f Mon Sep 17 00:00:00 2001 From: Lutz Reinhardt Date: Tue, 17 Feb 2026 09:46:34 +0000 Subject: [PATCH 09/13] Make run_reuse_annotate.sh fit to be run in other repos --- .pre-commit-config.yaml | 9 ++++++--- scripts/run_reuse_annotate.sh | 16 +++++++++++----- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 957265c..3f5dc03 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -37,7 +37,10 @@ repos: hooks: - id: shellcheck - # - repo: ./.git - # rev: 03973d8e5b02d40aabadbd9fb2c925099d524975 + # - repo: local # hooks: - # - id: reuse-annotate + # - id: reuse annotate + # name: Check and fix copyright headers with reuse annotate + # entry: ./scripts/run_reuse_annotate.sh + # language: unsupported_script + # pass_filenames: false diff --git a/scripts/run_reuse_annotate.sh b/scripts/run_reuse_annotate.sh index d0a1827..4a17d7b 100755 --- a/scripts/run_reuse_annotate.sh +++ b/scripts/run_reuse_annotate.sh @@ -19,13 +19,19 @@ set -euxo pipefail SCRIPT_PATH=$(readlink -f "$0") SCRIPT_DIR=$(dirname -- "${SCRIPT_PATH}") -pushd "${SCRIPT_DIR}/.." > /dev/null - -files_to_annotate=$(git ls-files) - # remove deleted files from the list of files to annotate deleted_files=$(git ls-files --deleted) -files_to_annotate=$(comm -23 <(git ls-files | sort) <(echo "${deleted_files}" | sort)) +files_to_annotate_rel=$(comm -23 <(git ls-files | sort) <(echo "${deleted_files}" | sort)) + +# absolute paths are needed, when used via .pre-commit-hooks.yaml by other repositories +root="$(pwd)" +files_to_annotate="" +for file in ${files_to_annotate_rel}; do + files_to_annotate+="${root}/${file} " +done + +# Use .reuse/templates specified at the devcontainer / source of pre-commit hook +pushd "${SCRIPT_DIR}/.." > /dev/null # shellcheck disable=SC2086 # Expansion of ${files_to_annotate} is intentional to pass the list of files as separate arguments to the reuse annotate command. From 4a7b1f1374bf9112d454e1f99a167d99c66ad23b Mon Sep 17 00:00:00 2001 From: Lutz Reinhardt Date: Tue, 17 Feb 2026 09:47:57 +0000 Subject: [PATCH 10/13] run reuse pre-commit hook again --- .pre-commit-config.yaml | 14 +++++++------- .pre-commit-hooks.yaml | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3f5dc03..3499968 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -37,10 +37,10 @@ repos: hooks: - id: shellcheck - # - repo: local - # hooks: - # - id: reuse annotate - # name: Check and fix copyright headers with reuse annotate - # entry: ./scripts/run_reuse_annotate.sh - # language: unsupported_script - # pass_filenames: false + - repo: local + hooks: + - id: reuse annotate + name: Check and fix copyright headers with reuse annotate + entry: ./scripts/run_reuse_annotate.sh + language: unsupported_script + pass_filenames: false diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index fed3c4a..4a3b7f4 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -1,4 +1,18 @@ --- +# ******************************************************************************* +# Copyright (c) 2026 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-FileCopyrightText: 2026 Contributors to the Eclipse Foundation +# SPDX-License-Identifier: Apache-2.0 +# ******************************************************************************* + - id: reuse-annotate name: Check and fix copyright headers with reuse annotate entry: scripts/run_reuse_annotate.sh From 8b5017798688e75dbaa575c179842749b6be3f7d Mon Sep 17 00:00:00 2001 From: Lutz Reinhardt Date: Tue, 17 Feb 2026 09:53:54 +0000 Subject: [PATCH 11/13] add sync comment --- .pre-commit-config.yaml | 3 ++- .pre-commit-hooks.yaml | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3499968..525a3ab 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -39,7 +39,8 @@ repos: - repo: local hooks: - - id: reuse annotate + # Keep in sync with .pre-commit-hooks.yaml, too much hazzle to reuse the same hook definition + - id: reuse-annotate name: Check and fix copyright headers with reuse annotate entry: ./scripts/run_reuse_annotate.sh language: unsupported_script diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 4a3b7f4..6f0c4a7 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -13,6 +13,7 @@ # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************* + # Keep in sync with .pre-commit-config.yaml, too much hazzle to reuse the same hook definition - id: reuse-annotate name: Check and fix copyright headers with reuse annotate entry: scripts/run_reuse_annotate.sh From c2a743cb05d841eb2236daba55c3458c0a217197 Mon Sep 17 00:00:00 2001 From: Lutz Reinhardt Date: Tue, 17 Feb 2026 10:16:06 +0000 Subject: [PATCH 12/13] another place where PIPX_BIN_DIR needs to be used --- scripts/run_reuse_annotate.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/run_reuse_annotate.sh b/scripts/run_reuse_annotate.sh index 4a17d7b..a94ecd8 100755 --- a/scripts/run_reuse_annotate.sh +++ b/scripts/run_reuse_annotate.sh @@ -35,7 +35,7 @@ pushd "${SCRIPT_DIR}/.." > /dev/null # shellcheck disable=SC2086 # Expansion of ${files_to_annotate} is intentional to pass the list of files as separate arguments to the reuse annotate command. -pipx run reuse annotate --template apache-2.0 --merge-copyrights --recursive --skip-unrecognised \ +"${PIPX_BIN_DIR}/pipx" run reuse annotate --template apache-2.0 --merge-copyrights --recursive --skip-unrecognised \ --copyright="Contributors to the Eclipse Foundation" --license=Apache-2.0 ${files_to_annotate} popd > /dev/null From 50061fca79faf59606ed771afc015ffd5c6eae57 Mon Sep 17 00:00:00 2001 From: Lutz Reinhardt Date: Tue, 17 Feb 2026 11:01:47 +0000 Subject: [PATCH 13/13] remove test comment --- .pre-commit-config.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 525a3ab..d1cfab0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,8 +13,6 @@ # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************* -#test - repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # v6.0.0