From 77262324dd7baada4fe4c5bfb4e25cb4b95aa793 Mon Sep 17 00:00:00 2001 From: JuanPablo Date: Sun, 26 Jun 2011 22:31:28 -0400 Subject: only in the master branch --- git-prompt.sh | 55 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/git-prompt.sh b/git-prompt.sh index 2b2869b..69f3c4a 100755 --- a/git-prompt.sh +++ b/git-prompt.sh @@ -506,32 +506,35 @@ parse_git_status() { # branch="$(git describe --exact-match HEAD 2>/dev/null)" || \ # branch="$(cut -c1-7 "$git_dir/HEAD")..." fi - # TODO : make this a module on/off - # hourly checks new commits in remotes - fetchUpdate=3600 - remotes=() - for remote in $(git remote) - do - if [[ ! -e $git_dir/FETCH_HEAD ]]; then - git fetch $remote >& /dev/null & - else - fetchDate=$(date --utc --reference=$git_dir/FETCH_HEAD +%s) - now=$(date --utc +%s) - delta=$(( $now - $fetchDate )) - # if last update to .git/FETCH_HEAD file - if [[ $delta -gt $fetchUpdate ]]; then - git fetch $remote >& /dev/null & - fi - fi - if [[ $(git branch -a | grep $remote) != "" ]]; then - nRemoteCommit=$(git log --oneline HEAD..$remote/master | wc -l) - if [[ -f $git_dir/FETCH_HEAD && $nRemoteCommit != "0" ]]; then - remotes+=" "${remote/origin/o}:$nRemoteCommit - fi - else - git fetch $remote >& /dev/null & - fi - done + if [[ $branch == "master" ]]; then + # Only work with master branch + # TODO : make this a module on/off + # hourly checks new commits in remotes + fetchUpdate=3600 + remotes=() + for remote in $(git remote) + do + if [[ ! -e $git_dir/FETCH_HEAD ]]; then + git fetch $remote >& /dev/null & + else + fetchDate=$(date --utc --reference=$git_dir/FETCH_HEAD +%s) + now=$(date --utc +%s) + delta=$(( $now - $fetchDate )) + # if last update to .git/FETCH_HEAD file + if [[ $delta -gt $fetchUpdate ]]; then + git fetch $remote >& /dev/null & + fi + fi + if [[ $(git branch -a | grep $remote) != "" ]]; then + nRemoteCommit=$(git log --oneline HEAD..$remote/master | wc -l) + if [[ -f $git_dir/FETCH_HEAD && $nRemoteCommit != "0" ]]; then + remotes+=" "${remote/origin/o}:$nRemoteCommit + fi + else + git fetch $remote >& /dev/null & + fi + done + fi #### GET GIT HEX-REVISION if [[ $rawhex_len -gt 0 ]] ; then -- cgit v1.2.3