summaryrefslogtreecommitdiff
path: root/.gitcheck
blob: c73c6b1690b5c83c9f7e0c7afd2b0f519d723454 (plain)
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
# SPDX-FileCopyrightText: 2022 Caleb La Grange <thonkpeasant@protonmail.com>
# SPDX-License-Identifier: GPL-3.0-only

Set_placeholder(){
	# Check if username and or email is set.
	if ! git config user.name || git config user.email ; then
		git config user.name || git config user.name 'lbmkplaceholder'
		git config user.email || git config user.email 'placeholder@lbmkplaceholder.com'
	fi
}

Clean(){
	if [ "$(git config user.name)" = "lbmkplaceholder" ]; then
		git config --unset user.name
	fi

	if [ "$(git config user.email)" = "placeholder@lbmkplaceholder.com" ]; then
		git config --unset user.email
	fi
}

Run(){
if [ "${1}" = "clean" ]; then
	Clean
else
	Set_placeholder

	# Check coreboot as well to prevent errors during building
	if [ -d coreboot ]; then
		cd coreboot
		Set_placeholder
		cd -
	fi
fi
}

Run $@ >/dev/null