Prefix config

This commit is contained in:
Toshiyuki Kawanishi 2014-06-14 11:48:46 +09:00
parent fc8b07c108
commit 5f3a359a0f
2 changed files with 21 additions and 2 deletions

15
git-now
View file

@ -9,7 +9,20 @@ GITNOW_DIR=$0
GITNOW_DIR=${GITNOW_DIR%\\*} # for msysGit
GITNOW_DIR=${GITNOW_DIR%/*} # for others
export GITNOW_DIR
PREFIX="from now"
prefix_config=`git config now.prefix`
if [ $? -eq 0 ]; then
PREFIX=$prefix_config
else
PREFIX="from now"
fi
bracket_config=`git config now.bracket`
if [ $? -eq 0 ]; then
BRACKET=$bracket_config
else
BRACKET=true
fi
usage() {
echo "usage: git now [-n] [-v] [--force | -f] [--interactive | -i] [--patch | -p]"

View file

@ -6,7 +6,13 @@ usage() {
}
cmd_default() {
MESSAGE="[${PREFIX}] `date +\"%Y/%m/%d %T\"`"
if [ $BRACKET = "true" ]; then
prefix_str="[${PREFIX}]"
else
prefix_str=$PREFIX
fi
MESSAGE="${prefix_str} `date +\"%Y/%m/%d %T\"`"
if [ $# -eq 0 ]; then
git add -u
printf "${MESSAGE}\n\n%s" "`git diff --cached --no-ext-diff`" | git commit -F -