summaryrefslogtreecommitdiff
path: root/contrib/completion/git-prompt.sh
AgeCommit message (Collapse)AuthorFilesLines
2012-10-17coloured git-prompt: paint detached HEAD marker in redLibravatar Junio C Hamano1-1/+1
Paint the marker for normal state in green and detached state in red, instead of the other way around. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-16Fix up colored git-promptLibravatar Simon Oosthoek1-23/+32
The main point is to match the colors to be more close to the color output of "git status -sb". - the branchname is green, or in red when the HEAD is detached; - the flags are either red or green for unstaged/staged and the remaining flags get a different color or none at all. Signed-off-by: Simon Oosthoek <s.oosthoek@xs4all.nl> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-11show color hints based on state of the git treeLibravatar Simon Oosthoek1-1/+35
By setting GIT_PS1_SHOW_COLORHINTS when using __git_ps1 as PROMPT_COMMAND, you will get color hints in addition to a different character (*+% etc.) to indicate the state of the tree. Signed-off-by: Simon Oosthoek <s.oosthoek@xs4all.nl> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-11Allow __git_ps1 to be used in PROMPT_COMMANDLibravatar Simon Oosthoek1-6/+45
Changes __git_ps1 to allow its use as PROMPT_COMMAND in bash in addition to setting PS1 with __git_ps1 in a command substitution. PROMPT_COMMAND has advantages for using color without running into prompt-wrapping issues. Only by assigning \[ and \] to PS1 directly can bash know that these and the enclosed zero-width codes in between don't count in the length of the prompt. Signed-off-by: Simon Oosthoek <s.oosthoek@xs4all.nl> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-24Improve the description of GIT_PS1_SHOWUPSTREAMLibravatar Jonathan "Duke" Leto1-3/+4
Describe what '=' means in the output of __git_ps1 when using GIT_PS1_SHOWUPSTREAM, which was not previously described. Signed-off-by: Jonathan "Duke" Leto <jonathan@leto.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-10completion: warn people about duplicated functionLibravatar Junio C Hamano1-0/+2
The __gitdir function is duplicated between completion and prompt scripts, and these definitions should not diverge; otherwise one of them can be subtly broken depending on the order the user's shell dot-sources them. Leave a note to people who may want to touch one copy to make sure they update the other one in sync. Hopefully this line would also appear in the context of the patch to allow reviewers to notice a patch that attempts to update only one of them. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-22completion: split __git_ps1 into a separate scriptLibravatar Felipe Contreras1-0/+287
bash-completion 1.90 shipped with support to load completions dynamically[1], which means the git completion script wouldn't be loaded until the user types 'git <tab>'--this creates a problem to people using __git_ps1(); that function won't be available when the shell is first created. For now distributions have workarounded this issue by moving the git completion to the "compatdir"[2]; this of course is not ideal. The solution, proposed by Kerrick Staley[3], is to split the git script in two; the part that deals with __git_ps1() in one (i.e. git-prompt.sh), and everything else in another (i.e. git-completion.bash). Another benefit of this is that zsh user that are not interested in the bash completion can use it for their prompts, which has been tried before[4]. The only slight issue is that __gitdir() would be duplicated, but this is probably not a big deal. So let's go ahead and move __git_ps1() to a new file. While at this, I took the liberty to reformat the help text in the new file. [1] http://anonscm.debian.org/gitweb/?p=bash-completion/bash-completion.git;a=commitdiff;h=99c4f7f25f50a7cb2fce86055bddfe389effa559 [2] http://projects.archlinux.org/svntogit/packages.git/commit/trunk?h=packages/git&id=974380fabb8f9f412990b17063bf578d98c44a82 [3] http://mid.gmane.org/CANaWP3w9KDu57aHquRRYt8td_haSWTBKs7zUHy-xu0B61gmr9A@mail.gmail.com [4] http://mid.gmane.org/1303824288-15591-1-git-send-email-mstormo@gmail.com Cc: Kerrick Staley <mail@kerrickstaley.com> Cc: Marius Storm-Olsen <mstormo@gmail.com> Cc: Ville Skyttä <ville.skytta@iki.fi> Cc: Dan McGee <dan@archlinux.org> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>