Re: [RFC/PATCHv2] bash completion: Support "divergence from upstream" warnings in __git_ps1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Michael J Gruber venit, vidit, dixit 09.06.2010 11:17:
...
> An alternative would be to use something like
> myrepo:master+5-3
> 
> The numbers should make this distinguishable from the "--cached +". Of
> course it eats up more space and is slightly confusing unless it is read
> master = upstream + 5 -3.
> OTOH it is very analogous to status -s and branch -vv.
...
>> +				if p="$( git rev-list \
>> +						--left-right "$upstream"...HEAD 2>/dev/null )"
> 
> Here you have all the info to do a "grep \<|wc -l" etc. instead of the
> below if you go for the +5-3.
> 
>> +				then
>> +					case "$p" in
>> +						\<*\>*|\>*\<* ) p="<>" ;;
>> +						*\<*          ) p="<"  ;;
>> +						*\>*          ) p=">"  ;;

I mean something like this

					case "$p" in
						\<*\>*|\>*\<* ) p="+"$(echo "$p"|grep ">"|wc -l)"-"$(echo
"$p"|grep "<"|wc -l)  ;;
						*\<*          ) p="-"$(echo "$p"|grep "<"|wc -l)  ;;
						*\>*          ) p="+"$(echo "$p"|grep ">"|wc -l)  ;;

with

		printf "${1:- (%s)}" "$c${b##refs/heads/}$p${f:+ $f}$r"

resulting in a prompt like

[mjg@localhost git (mjg/sane-symlink-diff+4-153 *+%)]

on my branch "mjg/sane-symlink-diff".

Cheers,
Michael
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]