Merge pull request #9 from toshi-kawanishi/prefix-config

Prefix config
This commit is contained in:
Motonori Iwata 2014-06-15 17:06:25 +09:00
commit 02b8d32571
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 -