Paper/scripts/functions.sh
Kyle Wood d45565f83b Handle gpg signing better (#1123)
Instead of checking whether it was set previously, setting it to false,
then setting it back to true if it was true before, just use the
command-line argument in git to override the config for that command.
Using a variable makes it pretty painless to do.
2018-05-24 13:41:50 -05:00

25 lines
442 B
Bash
Executable File

#!/usr/bin/env bash
gitcmd="git -c commit.gpgsign=false"
color() {
if [ $2 ]; then
echo -e "\e[$1;$2m"
else
echo -e "\e[$1m"
fi
}
colorend() {
echo -e "\e[m"
}
paperstash() {
STASHED=$($gitcmd stash 2>/dev/null|| return 0) # errors are ok
}
paperunstash() {
if [[ "$STASHED" != "No local changes to save" ]] ; then
$gitcmd stash pop 2>/dev/null|| return 0 # errors are ok
fi
}