summaryrefslogtreecommitdiff
path: root/.gitcheck
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2023-08-27 17:57:30 +0100
committerLeah Rowe <leah@libreboot.org>2023-08-27 18:17:31 +0100
commit4a280c629fca886547eb0f4ebbe6319b75b240d7 (patch)
tree39ec0a077c77e7a40507b8edc1339b6f036768a0 /.gitcheck
parent355eb765ff47b0855a6f5655312608d3264e70bf (diff)
.gitcheck: re-write entirely. force global config.
the way the old script worked was extremely hacky it's cleaner just to make the user configure git i haven't used anything from the old .gitcheck script, which is now deleted. i completely re-wrote this, in a much simpler way. this is less maintenance now, when things change in the upstream projects. coreboot makes heavy use of git within its build system Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to '.gitcheck')
-rwxr-xr-x.gitcheck81
1 files changed, 0 insertions, 81 deletions
diff --git a/.gitcheck b/.gitcheck
deleted file mode 100755
index b3405a9c..00000000
--- a/.gitcheck
+++ /dev/null
@@ -1,81 +0,0 @@
-#!/usr/bin/env sh
-# SPDX-FileCopyrightText: 2022 Caleb La Grange <thonkpeasant@protonmail.com>
-# SPDX-FileCopyrightText: 2023 Leah Rowe <leah@libreboot.org>
-# SPDX-License-Identifier: GPL-3.0-only
-
-. "include/err.sh"
-
-git_name="lbmkplaceholder"
-git_email="placeholder@lbmkplaceholder.com"
-
-main()
-{
- [ "$(id -u)" = "0" ] && return 0
-
- if [ $# -gt 0 ]; then
- if [ "${1}" = "clean" ]; then
- clean 1> /dev/null
- else
- err "unsupported argument, \"${1}\""
- fi
- else
- set_placeholders 1> /dev/null
- fi
-}
-
-set_placeholders()
-{
- set_git_credentials
-
- # Check coreboot as well to prevent errors during building
- [ -d coreboot ] || return 0
- for x in coreboot/*; do
- [ -d "${x}" ] || continue
- [ -e "${x}/.git" ] || continue
- (
- cd "${x}"
- set_git_credentials
- )
- done
-}
-
-set_git_credentials()
-{
- # 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 "${git_name}" || \
- err "cannot set local git user.name"
- git config user.email || git config user.email "${git_email}" \
- || err "cannot set local git user.email"
- fi
-}
-
-clean()
-{
- unset_placeholders
-
- [ -d coreboot ] || return 0
- for x in coreboot/*; do
- [ -d "${x}" ] || continue
- [ -e "${x}/.git" ] || continue
- (
- cd "${x}"
- unset_placeholders
- )
- done
-}
-
-unset_placeholders()
-{
- if [ "$(git config user.name)" = "${git_name}" ]; then
- git config --unset user.name || \
- err "cannot unset local git user.name"
- fi
-
- if [ "$(git config user.email)" = "${git_email}" ]; then
- git config --unset user.email || \
- err "cannot unset local git user.email"
- fi
-}
-
-main $@