summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshmalebx9 <thonkpeasant@protonmail.com>2022-03-15 12:02:04 -0600
committerLeah Rowe <leah@libreboot.org>2022-03-16 04:40:59 +0000
commit0b3b7f93b7ba4db761a960743c67a01f641e4165 (patch)
tree17f7924641d1441808a105d85874b0745039031c
parent8ca0761fb0651d064a4994be70ab85efffee6e48 (diff)
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
-rwxr-xr-x.gitcheck31
-rwxr-xr-xbuild4
-rwxr-xr-xdownload5
3 files changed, 40 insertions, 0 deletions
diff --git a/.gitcheck b/.gitcheck
new file mode 100755
index 00000000..7b77c1bc
--- /dev/null
+++ b/.gitcheck
@@ -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
diff --git a/build b/build
index 3425fe40..3539f726 100755
--- a/build
+++ b/build
@@ -5,6 +5,7 @@
# Copyright (C) 2014, 2015, 2020, 2021 Leah Rowe <info@minifree.org>
# Copyright (C) 2015 Patrick "P. J." McDermott <pj@pehjota.net>
# 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
# 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 <http://www.gnu.org/licenses/>.
#
+./.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 8de5e225..7d975d68 100755
--- a/download
+++ b/download
@@ -5,6 +5,7 @@
# Copyright (C) 2014, 2015, 2020, 2021 Leah Rowe <info@minifree.org>
# Copyright (C) 2015 Patrick "P. J." McDermott <pj@pehjota.net>
# 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
# 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/>.
#
+./.gitcheck
+
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
@@ -112,3 +115,5 @@ else
fi
exit 0
+
+./.gitcheck clean