lbmk/.gitcheck

39 lines
851 B
Plaintext
Raw Normal View History

#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2022 Caleb La Grange <thonkpeasant@protonmail.com>
# SPDX-License-Identifier: GPL-3.0-only
Set_placeholder(){
2022-11-21 03:42:31 +01:00
# 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 'lbmkplaceholder'
git config user.email || git config user.email 'placeholder@lbmkplaceholder.com'
fi
}
Clean(){
2022-11-15 11:21:57 +01:00
if [ "$(git config user.name)" = "lbmkplaceholder" ]; then
git config --unset user.name
fi
2022-11-15 11:21:57 +01:00
if [ "$(git config user.email)" = "placeholder@lbmkplaceholder.com" ]; then
git config --unset user.email
fi
}
Run(){
if [ "${1}" = "clean" ]; then
Clean
else
2022-11-21 03:42:31 +01:00
Set_placeholder
# Check coreboot as well to prevent errors during building
if [ -d coreboot ]; then
cd coreboot
Set_placeholder
2022-11-21 03:42:31 +01:00
cd -
fi
fi
}
Run >/dev/null