diff --git a/.bash.d/git-prompt-simple.sh b/.bash.d/git-prompt-simple.sh index 7957a5c..93b9fed 100644 --- a/.bash.d/git-prompt-simple.sh +++ b/.bash.d/git-prompt-simple.sh @@ -9,28 +9,14 @@ [[ "$-" != *i* ]] && return echo "[load] ${BASH_SOURCE:-$0}" -GIT_PS1_DIR=~/.tmp/git_ps1/`tty` -GIT_PS1_ENV=${GIT_PS1_DIR}/git_ps1.env -mkdir -p ${GIT_PS1_DIR} -touch ${GIT_PS1_ENV} - __git_ps1() { - . ${GIT_PS1_ENV} - if [ "${LAST_PWD}" != "${PWD}" ]; then - BRANCH=$(git rev-parse --abbrev-ref HEAD 2> /dev/null) - STATUS= - if [ ! -z $BRANCH ] && [ ! -z "$(git status --short)" ]; then - STATUS=! - fi -cat < ${GIT_PS1_ENV} -BRANCH=${BRANCH} -STATUS=${STATUS} -LAST_PWD=${PWD} -EOF +BRANCH=$(git rev-parse --abbrev-ref HEAD 2> /dev/null) +if [ ! -z $BRANCH ]; then + STATUS= + if [ ! -z "$(git status --short)" ]; then + STATUS=! fi - if [ ! -z $BRANCH ]; then - echo -n -e "\e[33m(${BRANCH}\e[31m${STATUS})" - fi + echo -n -e "\e[33m(${BRANCH}\e[31m${STATUS}\e[33m)" +fi } - diff --git a/.bash.d/git-prompt-simple.sh b/.bash.d/git-prompt-simple.sh index 7957a5c..93b9fed 100644 --- a/.bash.d/git-prompt-simple.sh +++ b/.bash.d/git-prompt-simple.sh @@ -9,28 +9,14 @@ [[ "$-" != *i* ]] && return echo "[load] ${BASH_SOURCE:-$0}" -GIT_PS1_DIR=~/.tmp/git_ps1/`tty` -GIT_PS1_ENV=${GIT_PS1_DIR}/git_ps1.env -mkdir -p ${GIT_PS1_DIR} -touch ${GIT_PS1_ENV} - __git_ps1() { - . ${GIT_PS1_ENV} - if [ "${LAST_PWD}" != "${PWD}" ]; then - BRANCH=$(git rev-parse --abbrev-ref HEAD 2> /dev/null) - STATUS= - if [ ! -z $BRANCH ] && [ ! -z "$(git status --short)" ]; then - STATUS=! - fi -cat < ${GIT_PS1_ENV} -BRANCH=${BRANCH} -STATUS=${STATUS} -LAST_PWD=${PWD} -EOF +BRANCH=$(git rev-parse --abbrev-ref HEAD 2> /dev/null) +if [ ! -z $BRANCH ]; then + STATUS= + if [ ! -z "$(git status --short)" ]; then + STATUS=! fi - if [ ! -z $BRANCH ]; then - echo -n -e "\e[33m(${BRANCH}\e[31m${STATUS})" - fi + echo -n -e "\e[33m(${BRANCH}\e[31m${STATUS}\e[33m)" +fi } - diff --git a/.bashrc b/.bashrc index 71c0713..b24cb25 100644 --- a/.bashrc +++ b/.bashrc @@ -61,6 +61,7 @@ # # Don't put duplicate lines in the history. # export HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups +export HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups # # Ignore some controlling instructions # HISTIGNORE is a colon-delimited list of patterns which should be excluded.