Merge pull request #89 from nulltask/feature/repl-display-branch

Added displaying current branch name to git-repl(1) prompt
This commit is contained in:
TJ Holowaychuk 2012-03-27 08:00:08 -07:00
commit 32f836bfd1

View file

@ -1,8 +1,19 @@
#!/bin/bash
while true; do
# Current branch
cur=`git symbolic-ref HEAD 2> /dev/null | cut -d/ -f3-`
# Prompt
if [ $cur ]
then
prompt="git ($cur)> "
else
prompt="git> "
fi
# Readline
read -e -r -p "git> " cmd
read -e -r -p "$prompt" cmd
# EOF
test $? -ne 0 && break