From 4a280c629fca886547eb0f4ebbe6319b75b240d7 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 27 Aug 2023 17:57:30 +0100 Subject: .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 --- .gitcheck | 81 --------------------------------------------------------------- 1 file changed, 81 deletions(-) delete mode 100755 .gitcheck (limited to '.gitcheck') 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 -# SPDX-FileCopyrightText: 2023 Leah Rowe -# 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 $@ -- cgit v1.2.1