Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monitoring of remote branch #13

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
c328f70
Makefile cambiando la forma de instalar
juanpabloaj Apr 27, 2011
eba1ba5
fijando algunos colores
juanpabloaj Apr 27, 2011
cdcb6d9
merge con lvv/git-prompt
juanpabloaj Apr 29, 2011
e190a36
Merge branch 'upstream'
juanpabloaj May 30, 2011
b65e761
Merge remote-tracking branch 'lvv/master'
juanpabloaj Jun 26, 2011
0126f3a
add folder markers
juanpabloaj Jun 26, 2011
6c3dc14
begin monitoring of remotes branchs
juanpabloaj Jun 26, 2011
ee32d1b
when remote is origin show o:
juanpabloaj Jun 26, 2011
5dd8de5
unset remotes
juanpabloaj Jun 26, 2011
75205c3
unset remotes;changed position
juanpabloaj Jun 27, 2011
137dbad
fixed bad route to .git
juanpabloaj Jun 27, 2011
8cc86ba
remote origin o
juanpabloaj Jun 27, 2011
ed28d3e
only in the master branch
juanpabloaj Jun 27, 2011
42850e2
Makefile : install , clean ; REDME.md
juanpabloaj Jun 27, 2011
fb6ec6c
Merge remote-tracking branch 'lvv/master'
juanpabloaj Jun 28, 2011
254ee7d
Merge remote-tracking branch 'lvv/master'
juanpabloaj Jul 2, 2011
eeaae51
a screenshot
juanpabloaj Jul 2, 2011
70e539b
screenshot for svn
juanpabloaj Jul 2, 2011
0aa0c9b
from blob to raw
juanpabloaj Jul 2, 2011
66a1020
sin linea
juanpabloaj Jul 2, 2011
7cc976b
README to markdown
juanpabloaj Jul 2, 2011
b5b5049
ignoring Done message #13 in subshell
juanpabloaj Jul 4, 2011
27fe45d
ignoring Done message
juanpabloaj Jul 4, 2011
12cae51
merge with remote-watch
juanpabloaj Jul 4, 2011
d1ce45a
make install : reescribir links
juanpabloaj Jul 5, 2011
966ab76
Merge remote-tracking branch 'lvv/master'
juanpabloaj Aug 29, 2011
e266a6f
hostname command in cygwin
juanpabloaj Sep 9, 2011
277288a
gitremotes added
juanpabloaj Oct 17, 2011
697cbce
Merge remote-tracking branch 'lvv/master'
juanpabloaj Jul 24, 2012
eae25b4
nombre corto para directorio
juanpabloaj Sep 9, 2012
5b17846
README sin espacios en blanco innecesarios
juanpabloaj Mar 17, 2014
2552f98
git-prompt.sh sin espacion en blancos innecesarios
juanpabloaj Mar 17, 2014
1bfd7ed
Merge remote-tracking branch 'lvv/master'
juanpabloaj Mar 18, 2014
bed5ec2
hex hash in white and with 6 digits
juanpabloaj Feb 7, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.html
*swp

# emacs backup and lock files
*~
Expand Down
4 changes: 4 additions & 0 deletions .gitremotes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
lvv git://github.com/lvv/git-prompt.git (fetch)
lvv git://github.com/lvv/git-prompt.git (push)
origin [email protected]:juanpabloaj/git-prompt.git (fetch)
origin [email protected]:juanpabloaj/git-prompt.git (push)
29 changes: 9 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
ifeq ($(USER),lvv)
HOMEDIR := /home/lvv/p/volnitsky.com/
INCLUDE := $(HOMEDIR)/include.mk
else
INCLUDE := /dev/null
endif

include $(INCLUDE)


COPY_LIST = git-prompt.sh


install:
cp -v git-prompt.sh /etc/
[ -f /etc/git-prompt.conf ] || cp -v git-prompt.conf /etc/

tgit:
xclip -i git-demo
echo "ready to paste ..."

[ -f $(HOME)/.git-prompt.conf ] || ln -vfn -s $(shell pwd)/git-prompt.conf $(HOME)/.git-prompt.conf
@echo
@echo 'add to ~/.bashrc'
@echo '[[ $$- == *i* ]] && . $(PWD)/git-prompt.sh'
clean:
[ -f $(HOME)/.git-prompt.conf ] && unlink $(HOME)/.git-prompt.conf
@echo
@echo 'remove in ~/.bashrc'
@echo '[[ $$- == *i* ]] && . $(PWD)/git-prompt.sh'
5 changes: 0 additions & 5 deletions README

This file was deleted.

15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# GIT Prompt for BASH

Forked from [lvv-git-prompt](https://github.com/lvv/git-prompt)

Screenshots and docs are at: [volnitsky.com](http://volnitsky.com/project/git-prompt)

## Screenshots

### prompt-git

![prompt-git](https://github.com/juanpabloaj/git-prompt/raw/master/screenshot-prompt-git.png)

### prompt-svn

![prompt-svn](https://github.com/juanpabloaj/git-prompt/raw/master/screenshot-svn.png)
22 changes: 12 additions & 10 deletions git-prompt.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@

############################################################ MODULES

# git_module=on
# svn_module=off
# hg_module=on
# vim_module=on
git_module=on
svn_module=on
hg_module=on
vim_module=on
# virtualenv_module=on


Expand All @@ -31,15 +31,17 @@

########################################################### Current Working Dir display
# cwd_cmd='\w' # display full path
## cwd_cmd='\W' # display only last dir of path
cwd_cmd='\W' # display only last dir of path
## cwd_cmd='cwd_truncate 40' # display only last N chars of path

########################################################### ETC

# Some don't like hostname in uppercase
# upcase_hostname=on # =off
upcase_hostname=off
# Some don't like long hostname
# short_hostname=off # =on
short_hostname=on

# Do not do VCS parsing for listed directories
# useful for directories for which it is difficult to maintain .gitignore so
Expand All @@ -50,12 +52,12 @@

### directory, exit code, root color

# cols=`tput colors`
cols=`tput colors`
# if [[ -n "$cols" && $cols -ge 8 ]]; then # if terminal supports colors
# dir_color=CYAN
# rc_color=red
dir_color=white
rc_color=red
# virtualenv_color=green
# user_id_color=blue
user_id_color=white
# root_id_color=magenta
# else # B/W terminal
# dir_color=bw_bold
Expand All @@ -65,7 +67,7 @@
### prompt character for root/non-root, default '>' for both
# prompt_char='>'
# root_prompt_char='>'
## prompt_char='$'
prompt_char='$'
## prompt_char='➔'
## root_prompt_char='#'

Expand Down
47 changes: 35 additions & 12 deletions git-prompt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@
op_vcs_color=${op_vcs_color:-MAGENTA}
detached_vcs_color=${detached_vcs_color:-RED}

hex_vcs_color=${hex_vcs_color:-BLACK} # gray
hex_vcs_color=${hex_vcs_color:-white}


max_file_list_length=${max_file_list_length:-100}
short_hostname=${short_hostname:-off}
upcase_hostname=${upcase_hostname:-on}
count_only=${count_only:-off}
rawhex_len=${rawhex_len:-5}
rawhex_len=${rawhex_len:-6}

aj_max=20

Expand Down Expand Up @@ -323,6 +323,8 @@ set_shell_label() {
color_index=(green yellow blue magenta cyan white) # FIXME: bw, color-256
host_color=${color_index[cksum_color_no]}
fi
#host_color fix in white
host_color=white

host_color=${!host_color}

Expand Down Expand Up @@ -517,7 +519,35 @@ parse_git_status() {
# branch="$(git describe --exact-match HEAD 2>/dev/null)" || \
# branch="$(cut -c1-7 "$git_dir/HEAD")..."
fi

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
Expand Down Expand Up @@ -564,6 +594,7 @@ parse_vcs_status() {
unset vcs vcs_info
unset status modified untracked added init detached
unset file_list modified_files untracked_files added_files
unset remotes

[[ $vcs_ignore_dir_list =~ $PWD ]] && return

Expand Down Expand Up @@ -632,7 +663,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 }"
Expand All @@ -654,7 +685,6 @@ parse_virtualenv_status() {
disable_set_shell_label() {
trap - DEBUG >& /dev/null
}

# show currently executed command in label
enable_set_shell_label() {
disable_set_shell_label
Expand Down Expand Up @@ -684,11 +714,8 @@ j (){
done
echo '?'
}

alias jumpstart='echo ${aj_dir_list[@]}'

###################################################################### PROMPT_COMMAND

prompt_command_function() {
rc="$?"

Expand Down Expand Up @@ -717,11 +744,7 @@ prompt_command_function() {

unset head_local tail_local pwd
}

PROMPT_COMMAND=prompt_command_function

enable_set_shell_label

unset rc id tty modified_files file_list

# vim: set ft=sh ts=8 sw=8 et: