2016-04-10 09:33:32 +08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2018-05-25 02:41:50 +08:00
|
|
|
gitcmd="git -c commit.gpgsign=false"
|
|
|
|
|
2016-04-10 09:33:32 +08:00
|
|
|
color() {
|
|
|
|
if [ $2 ]; then
|
|
|
|
echo -e "\e[$1;$2m"
|
|
|
|
else
|
|
|
|
echo -e "\e[$1m"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
colorend() {
|
|
|
|
echo -e "\e[m"
|
|
|
|
}
|
|
|
|
|
|
|
|
paperstash() {
|
2018-05-25 02:41:50 +08:00
|
|
|
STASHED=$($gitcmd stash 2>/dev/null|| return 0) # errors are ok
|
2016-04-10 09:33:32 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
paperunstash() {
|
|
|
|
if [[ "$STASHED" != "No local changes to save" ]] ; then
|
2018-05-25 02:41:50 +08:00
|
|
|
$gitcmd stash pop 2>/dev/null|| return 0 # errors are ok
|
2016-04-10 09:33:32 +08:00
|
|
|
fi
|
|
|
|
}
|