From 0b3b7f93b7ba4db761a960743c67a01f641e4165 Mon Sep 17 00:00:00 2001 From: shmalebx9 Date: Tue, 15 Mar 2022 12:02:04 -0600 Subject: [PATCH] added workaround for git credentials this is cherry-picked from osbmk. the cherry-pick was performed by i, leah rowe. this is adapted from shmalebx's patch there, in osboot specifically, these patches from osbmk are being imported: 327a39ef058d5385bf8c1a1b09bac8db6a51b016 5139ad4be4df1835ce154f39161eef4f7c31ee1a --- .gitcheck | 31 +++++++++++++++++++++++++++++++ build | 4 ++++ download | 5 +++++ 3 files changed, 40 insertions(+) create mode 100755 .gitcheck diff --git a/.gitcheck b/.gitcheck new file mode 100755 index 0000000..7b77c1b --- /dev/null +++ b/.gitcheck @@ -0,0 +1,31 @@ +#!/usr/bin/env bash +# SPDX-FileCopyrightText: 2022 Caleb La Grange +# SPDX-License-Identifier: GPL-3.0-only + +Set_placeholder(){ + git config user.name || git config user.name 'osbmkplaceholder' + git config user.email || git config user.email 'placeholder@osbmkplaceholder.com' +} + +Clean(){ + if [ "$(git config user.name)" = "osbmkplaceholder" ]; then + git config --unset user.name + fi + + if [ "$(git config user.email)" = "placeholder@osbmkplaceholder.com" ]; then + git config --unset user.email + fi +} + +Run(){ +if [ "${1}" = "clean" ]; then + Clean +else + # Check if username and or email is set. + if ! git config user.name || git config user.email ; then + Set_placeholder + fi +fi +} + +Run >/dev/null diff --git a/build b/build index 3425fe4..3539f72 100755 --- a/build +++ b/build @@ -5,6 +5,7 @@ # Copyright (C) 2014, 2015, 2020, 2021 Leah Rowe # Copyright (C) 2015 Patrick "P. J." McDermott # Copyright (C) 2015, 2016 Klemens Nanni +# Copyright (C) 2022, Caleb La Grange # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -19,6 +20,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # +./.gitcheck [ "x${DEBUG+set}" = 'xset' ] && set -v set -u -e @@ -105,3 +107,5 @@ else help exit 0 fi + +./.gitcheck clean diff --git a/download b/download index 8de5e22..7d975d6 100755 --- a/download +++ b/download @@ -5,6 +5,7 @@ # Copyright (C) 2014, 2015, 2020, 2021 Leah Rowe # Copyright (C) 2015 Patrick "P. J." McDermott # Copyright (C) 2015, 2016 Klemens Nanni +# Copyright (C) 2022, Caleb La Grange # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -20,6 +21,8 @@ # along with this program. If not, see . # +./.gitcheck + [ "x${DEBUG+set}" = 'xset' ] && set -v set -u -e @@ -112,3 +115,5 @@ else fi exit 0 + +./.gitcheck clean