summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuanPablo <jpabloaj@gmail.com>2011-06-26 17:56:00 -0400
committerLeonid Volnitsky <Leonid@Volnitsky.com>2011-07-01 09:08:39 +0300
commit89501c0a430438c58617adbe7d3282a972d5fb84 (patch)
tree36f979a0191fbc83d2d8e75ab1b20bc35ebd82f1
parent-- (diff)
downloadgit-prompt-89501c0a430438c58617adbe7d3282a972d5fb84.tar.gz
git-prompt-89501c0a430438c58617adbe7d3282a972d5fb84.tar.bz2
git-prompt-89501c0a430438c58617adbe7d3282a972d5fb84.zip
begin monitoring of remotes branchs
-rwxr-xr-xgit-prompt.sh28
1 files changed, 26 insertions, 2 deletions
diff --git a/git-prompt.sh b/git-prompt.sh
index ee025a1..7743927 100755
--- a/git-prompt.sh
+++ b/git-prompt.sh
@@ -506,7 +506,31 @@ 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/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
+ if [[ -f $git_dir/FETCH_HEAD && $(git log --oneline HEAD..$remote/master) != "" ]]; then
+ remotes+=" "$remote:$(git log --oneline HEAD..$remote/master | wc -l)
+ fi
+ else
+ git fetch $remote >& /dev/null &
+ fi
+ done
#### GET GIT HEX-REVISION
if [[ $rawhex_len -gt 0 ]] ; then
@@ -621,7 +645,7 @@ parse_vcs_status() {
fi
- head_local="$vcs_color(${vcs_info}$vcs_color${file_list}$vcs_color)"
+ head_local="$vcs_color(${vcs_info}$vcs_color${file_list}$vcs_color$remotes)"
### fringes
head_local="${head_local+$vcs_color$head_local }"