summaryrefslogtreecommitdiff
path: root/.gitcheck
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 /.gitcheck
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
Diffstat (limited to '.gitcheck')
-rwxr-xr-x.gitcheck31
1 files changed, 31 insertions, 0 deletions
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 <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