File: pre-commit.hook

package info (click to toggle)
pitivi 2023.03-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 22,468 kB
  • sloc: python: 33,616; ansic: 104; sh: 82; makefile: 6
file content (37 lines) | stat: -rwxr-xr-x 890 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env bash

# This is symlinked from .git/hooks/pre-commit when entering
# the dev env with `. bin/pitivi-env`, or manually.

TOPLEVEL=$(git rev-parse --show-toplevel)
export PYTHONPATH=$TOPLEVEL/pitivi/coptimizations/.libs:$PYTHONPATH

PRECOMMIT=""
if test -n "${PITIVI_REPO_DIR}"
then
    PRECOMMIT="$TOPLEVEL/build/flatpak/pitivi-flatpak pre-commit"
elif test -n "${INSIDE_GNOME_BUILDER}"
then
    PRECOMMIT=$(which /app/bin/pre-commit)
fi

if test -z "$PRECOMMIT"
then
    cat <<EOF
ERROR: Cannot find the flatpak sandbox.

       If you are using GNOME Builder, you can commit only
       from a Build Terminal.

       If you are using the Pitivi development environment,
       enter it by running:
           $ . bin/pitivi-env

       See http://developer.pitivi.org/HACKING.html for details.

EOF
    exit 1
fi


$PRECOMMIT run --config .pre-commit-config.yaml || exit 1