File: pre-commit-setup.bash

package info (click to toggle)
elastix 5.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 45,644 kB
  • sloc: cpp: 85,720; lisp: 4,118; python: 1,045; sh: 200; xml: 182; makefile: 33
file content (30 lines) | stat: -rwxr-xr-x 668 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/env bash

die() {
	echo 1>&2 "$@" ; exit 1
}

# Make sure we are inside the repository.
cd "${BASH_SOURCE%/*}" &&

exe_ext=""
if [[ "$(uname -o)" == "Msys" ]]; then
    exe_ext=".exe"
fi

# check if curl executable exists
if ! command -v curl &> /dev/null; then
    die "curl is required."
fi &&
git_dir=$(git rev-parse --git-dir) &&
mkdir -p "$git_dir/hooks" &&
(
cd "$git_dir/hooks" &&
pixi_exe=$git_dir/hooks/pixi/bin/pixi$exe_ext &&
if [[ -f "$pixi_exe" ]]; then
    $pixi_exe run pre-commit-install
    exit $?
fi &&
curl -fsSL https://pixi.sh/install.sh | PIXI_HOME=$git_dir/hooks/pixi PIXI_NO_PATH_UPDATE=1 bash &&
$pixi_exe run pre-commit-install
)