.gitcheck 724 B

1234567891011121314151617181920212223242526272829303132
  1. #!/usr/bin/env bash
  2. # SPDX-FileCopyrightText: 2022 Caleb La Grange <thonkpeasant@protonmail.com>
  3. # SPDX-License-Identifier: GPL-3.0-only
  4. Set_placeholder(){
  5. git config user.name || git config user.name 'osbmkplaceholder'
  6. git config user.email || git config user.email 'placeholder@osbmkplaceholder.com'
  7. }
  8. Clean(){
  9. if [ "$(git config user.name)" = "osbmkplaceholder" ]; then
  10. git config --unset user.name
  11. fi
  12. if [ "$(git config user.email)" = "placeholder@osbmkplaceholder.com" ]; then
  13. git config --unset user.email
  14. fi
  15. }
  16. Run(){
  17. if [ "${1}" = "clean" ]; then
  18. Clean
  19. else
  20. # Check if username and or email is set.
  21. if ! git config user.name || git config user.email ; then
  22. Set_placeholder
  23. fi
  24. fi
  25. }
  26. Run >/dev/null