summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuanPablo <jpabloaj@gmail.com>2011-06-26 22:31:28 -0400
committerLeonid Volnitsky <Leonid@Volnitsky.com>2011-07-01 09:21:01 +0300
commit77262324dd7baada4fe4c5bfb4e25cb4b95aa793 (patch)
treeefb6a5548b19729be1c0f01c95bf210a790e3965
parentremote origin o (diff)
downloadgit-prompt-77262324dd7baada4fe4c5bfb4e25cb4b95aa793.tar.gz
git-prompt-77262324dd7baada4fe4c5bfb4e25cb4b95aa793.tar.bz2
git-prompt-77262324dd7baada4fe4c5bfb4e25cb4b95aa793.zip
only in the master branch
-rwxr-xr-xgit-prompt.sh55
1 files 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