post-update.sample2 (651B)
1 #!/usr/bin/env sh
2 # SPDX-License-Identifier: AGPL-3.0-or-later
3 # SPDX-FileCopyrightText: 2021-2024 JayVii <jayvii[AT]posteo[DOT]de>
4
5 # REUSE linting on push from bare git repository:
6 # https://reuse.software
7
8 # Define temporary file and directory
9 TMP_ARC=`mktemp`
10 TMP_DIR=`mktemp --directory`
11
12 # get current branch
13 BRANCH=`git branch --show-current || echo "HEAD"`
14
15 # Create archive from bare git repository
16 git archive $BRANCH . --format=tar.gz -o "${TMP_ARC}"
17
18 # Extract archive to temporary directory
19 tar xfz "${TMP_ARC}" -- directory "${TMP_DIR}/"
20
21 # Lint via reuse tool
22 reuse --root "${TMP_DIR}/" lint
23
24 # Cleanup
25 rm -r "${TMP_DIR}" "${TMP_ARC}"
26