File: pre-commit.sh

package info (click to toggle)
topgit 0.8-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, trixie
  • size: 336 kB
  • sloc: sh: 1,573; makefile: 38
file content (38 lines) | stat: -rw-r--r-- 695 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
38
#!/bin/sh
# TopGit - A different patch queue manager
# (c) Petr Baudis <pasky@suse.cz>  2008
# GPLv2


## Set up all the tg machinery

set -e
tg__include=1
tg_util() {
	. "@bindir@"/tg
}
tg_util


## Generally have fun

# Don't do anything on non-topgit branch
if head_=$(git symbolic-ref -q HEAD); then
	case "$head_" in
		refs/heads/*)
			git rev-parse -q --verify "refs/top-bases${head_#refs/heads}" >/dev/null || exit 0;;
		*)
			exit 0;;
	esac

else
	exit 0;
fi

# TODO: check the index, not the working copy
[ -s "$root_dir/.topdeps" ] ||
	die ".topdeps is missing"
[ -s "$root_dir/.topmsg" ] ||
	die ".topmsg is missing"

# TODO: Verify .topdeps for valid branch names and against cycles