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

GIT_PS1_SHOWUPSTREAM like in bash_completion #110

Closed
mathieuroche opened this issue Mar 12, 2013 · 5 comments
Closed

GIT_PS1_SHOWUPSTREAM like in bash_completion #110

mathieuroche opened this issue Mar 12, 2013 · 5 comments
Labels
enhancement Feature request git Related to Git VCS data

Comments

@mathieuroche
Copy link

It'll be nice to have the same information as in bash_completion (work also with zsh).

Thanks.

GIT_PS1_SHOWUPSTREAM

# If you would like to see the difference between HEAD and its
#       upstream, set GIT_PS1_SHOWUPSTREAM="auto".  A "<" indicates
#       you are behind, ">" indicates you are ahead, and "<>"
#       indicates you have diverged.  You can further control
#       behaviour by setting GIT_PS1_SHOWUPSTREAM to a space-separated
#       list of values:
#           verbose       show number of commits ahead/behind (+/-) upstream
#           legacy        don't use the '--count' option available in recent
#                         versions of git-rev-list
#           git           always compare HEAD to @{upstream}
#           svn           always compare HEAD to your SVN upstream
#       By default, __git_ps1 will compare HEAD to your SVN upstream
#       if it can find one, or @{upstream} otherwise.  Once you have
#       set GIT_PS1_SHOWUPSTREAM, you can override it on a
#       per-repository basis by setting the bash.showUpstream config
#       variable.
@dolmen
Copy link
Collaborator

dolmen commented Dec 5, 2013

👍

@dolmen
Copy link
Collaborator

dolmen commented Jan 19, 2014

We just need someone motivated to work on that...

jaesivsm added a commit to jaesivsm/liquidprompt that referenced this issue Jan 19, 2014
@jaesivsm
Copy link
Contributor

It's a cool feature indeed, and I have produced a first draft for its implementation but I have two problems with it :

  • I have to make another call to git rev-list. Couldn't find a way around it. Maybe a fresh look on that may find a smarter solution.
  • I implemented the verbose version of GIT_PS1_SHOWUPSTREAM as it is more consistent with the existing feature of counting unpushed commits. It shouldn't be to hard to implement the "</>" thingy though, so just tell me if you want it any other way.

@jaesivsm
Copy link
Contributor

After a bit of testing, it seems that adding a git rev-list doesn't impact that much the overall performences of the _lp_git_branch_color function.

See patched :

time for i in `seq 1000`; do _lp_git_branch_color > /dev/null ; done 

real    1m6.542s
user    0m9.009s
sys 0m9.573s

Against unpatched :

time for i in `seq 1000`; do _lp_git_branch_color > /dev/null ; done 

real    1m1.605s
user    0m8.297s
sys 0m9.557s

I'll do a pull request.

jaesivsm added a commit to jaesivsm/liquidprompt that referenced this issue Jan 20, 2014
as the activation of GIT_PS1_SHOWUPSTREAM option does for __git_ps1
the _lp_git_branch_color now compute how many commit we are ahead or
behind of our remote reference.
jaesivsm added a commit to jaesivsm/liquidprompt that referenced this issue Jan 22, 2014
as the activation of GIT_PS1_SHOWUPSTREAM option does for __git_ps1
the _lp_git_branch_color now compute how many commit we are ahead or
behind of our remote reference.
jaesivsm added a commit to jaesivsm/liquidprompt that referenced this issue Jan 22, 2014
as the activation of GIT_PS1_SHOWUPSTREAM option does for __git_ps1
the _lp_git_branch_color now compute how many commit we are ahead or
behind of our remote reference.
jaesivsm added a commit to jaesivsm/liquidprompt that referenced this issue Apr 19, 2014
as the activation of GIT_PS1_SHOWUPSTREAM option does for __git_ps1
the _lp_git_branch_color now compute how many commit we are ahead or
behind of our remote reference.
jaesivsm added a commit to jaesivsm/liquidprompt that referenced this issue Aug 8, 2014
as the activation of GIT_PS1_SHOWUPSTREAM option does for __git_ps1
the _lp_git_branch_color now compute how many commit we are ahead or
behind of our remote reference.
jaesivsm added a commit to jaesivsm/liquidprompt that referenced this issue Oct 13, 2014
as the activation of GIT_PS1_SHOWUPSTREAM option does for __git_ps1
the _lp_git_branch_color now compute how many commit we are ahead or
behind of our remote reference.
jaesivsm added a commit to jaesivsm/liquidprompt that referenced this issue Nov 15, 2014
as the activation of GIT_PS1_SHOWUPSTREAM option does for __git_ps1
the _lp_git_branch_color now compute how many commit we are ahead or
behind of our remote reference.
jaesivsm added a commit to jaesivsm/liquidprompt that referenced this issue Dec 8, 2014
as the activation of GIT_PS1_SHOWUPSTREAM option does for __git_ps1
the _lp_git_branch_color now compute how many commit we are ahead or
behind of our remote reference.
dolmen pushed a commit that referenced this issue Dec 13, 2014
as the activation of GIT_PS1_SHOWUPSTREAM option does for __git_ps1
the _lp_git_branch_color now compute how many commit we are ahead or
behind of our remote reference.
@dolmen
Copy link
Collaborator

dolmen commented Dec 13, 2014

#269 is now merged in develop. This is the implementation of GIT_PS1_SHOWUPSTREAM=verbose.

@dolmen dolmen closed this as completed Dec 13, 2014
pkkolos pushed a commit to pkkolos/liquidprompt that referenced this issue Dec 16, 2014
as the activation of GIT_PS1_SHOWUPSTREAM option does for __git_ps1
the _lp_git_branch_color now compute how many commit we are ahead or
behind of our remote reference.

Conflicts:
	liquidprompt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request git Related to Git VCS data
Projects
None yet
Development

No branches or pull requests

3 participants