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
fsdg20230625
shmalebx9 2022-03-15 12:02:04 -06:00 committed by Leah Rowe
parent 8ca0761fb0
commit 0b3b7f93b7
3 changed files with 40 additions and 0 deletions

31
.gitcheck Executable file
View File

@ -0,0 +1,31 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2022 Caleb La Grange <thonkpeasant@protonmail.com>
# 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

4
build
View File

@ -5,6 +5,7 @@
# Copyright (C) 2014, 2015, 2020, 2021 Leah Rowe <info@minifree.org> # Copyright (C) 2014, 2015, 2020, 2021 Leah Rowe <info@minifree.org>
# Copyright (C) 2015 Patrick "P. J." McDermott <pj@pehjota.net> # Copyright (C) 2015 Patrick "P. J." McDermott <pj@pehjota.net>
# Copyright (C) 2015, 2016 Klemens Nanni <contact@autoboot.org> # Copyright (C) 2015, 2016 Klemens Nanni <contact@autoboot.org>
# Copyright (C) 2022, Caleb La Grange <thonkpeasant@protonmail.com>
# #
# This program is free software: you can redistribute it and/or modify # 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 # 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 # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
./.gitcheck
[ "x${DEBUG+set}" = 'xset' ] && set -v [ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e set -u -e
@ -105,3 +107,5 @@ else
help help
exit 0 exit 0
fi fi
./.gitcheck clean

View File

@ -5,6 +5,7 @@
# Copyright (C) 2014, 2015, 2020, 2021 Leah Rowe <info@minifree.org> # Copyright (C) 2014, 2015, 2020, 2021 Leah Rowe <info@minifree.org>
# Copyright (C) 2015 Patrick "P. J." McDermott <pj@pehjota.net> # Copyright (C) 2015 Patrick "P. J." McDermott <pj@pehjota.net>
# Copyright (C) 2015, 2016 Klemens Nanni <contact@autoboot.org> # Copyright (C) 2015, 2016 Klemens Nanni <contact@autoboot.org>
# Copyright (C) 2022, Caleb La Grange <thonkpeasant@protonmail.com>
# #
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -20,6 +21,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
./.gitcheck
[ "x${DEBUG+set}" = 'xset' ] && set -v [ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e set -u -e
@ -112,3 +115,5 @@ else
fi fi
exit 0 exit 0
./.gitcheck clean