Re: [PATCH 3/3] for-each-ref: introduce %(upstream:track[short])

2013-11-01 Thread Junio C Hamano
This patch needed on top of 3/3 for me to pass gcc cleanly. -- >8 -- Subject: [PATCH] fixup! for-each-ref: introduce %(upstream:track[short]) The condition !prefixcmp(name, "upstream") must be true for the variable "branch" to be reused, so the variable should be always set when it gets used, but

[PATCH 3/3] for-each-ref: introduce %(upstream:track[short])

2013-10-31 Thread Ramkumar Ramachandra
Introduce %(upstream:track) to display "[ahead M, behind N]" and %(upstream:trackshort) to display "=", ">", "<", or "<>" appropriately (inspired by contrib/completion/git-prompt.sh). Now you can use the following format in for-each-ref: %C(green)%(refname:short)%C(reset)%(upstream:trackshort)

Re: [PATCH 3/3] for-each-ref: introduce %(upstream:track[short])

2013-09-27 Thread Jonathan Nieder
Johannes Sixt wrote: > Am 9/27/2013 14:10, schrieb Ramkumar Ramachandra: >> +v->s = xstrdup(buf); >> +} > > These strdupped strings are leaked, right? The convention seems to be that each refinfo owns its atom_value, which owns its s

Re: [PATCH 3/3] for-each-ref: introduce %(upstream:track[short])

2013-09-27 Thread Philip Oakley
From: "Ramkumar Ramachandra" Philip Oakley wrote: "=" and "<>" I can easily understand (binary choice), but ">" and "<" will need to be clear which way they indicate in terms of matching the "[ahead N]" and "[behind M]" options. The ">" corresponds to ahead, while "<" is behind. You'll get

Re: [PATCH 3/3] for-each-ref: introduce %(upstream:track[short])

2013-09-27 Thread Ramkumar Ramachandra
Philip Oakley wrote: > "=" and "<>" I can easily understand (binary choice), but ">" and "<" will > need to be clear which way they indicate in terms of matching > the "[ahead N]" and "[behind M]" options. The ">" corresponds to ahead, while "<" is behind. You'll get used to it pretty quickly :)

Re: [PATCH 3/3] for-each-ref: introduce %(upstream:track[short])

2013-09-27 Thread Philip Oakley
- Original Message - From: "Ramkumar Ramachandra" Sent: Friday, September 27, 2013 1:10 PM Introduce %(upstream:track) to display "[ahead M, behind N]" and %(upstream:trackshort) to display "=", ">", "<", or "<>" appropriately (inspired by contrib/completion/git-prompt.sh). Now you can

Re: [PATCH 3/3] for-each-ref: introduce %(upstream:track[short])

2013-09-27 Thread Ramkumar Ramachandra
Johannes Sixt wrote: >> + else if (!num_ours) { >> + sprintf(buf, "[behind %d]", >> num_theirs); >> + v->s = xstrdup(buf); >> + } else if (!num_theirs) { >> +

Re: [PATCH 3/3] for-each-ref: introduce %(upstream:track[short])

2013-09-27 Thread Ramkumar Ramachandra
Phil Hord wrote: >> --- a/builtin/for-each-ref.c >> +++ b/builtin/for-each-ref.c >> @@ -631,6 +631,7 @@ static void populate_value(struct refinfo *ref) >> int eaten, i; >> unsigned long size; >> const unsigned char *tagged; >> + int upstream_present = 0; > > This flag

Re: [PATCH 3/3] for-each-ref: introduce %(upstream:track[short])

2013-09-27 Thread Johannes Sixt
Am 9/27/2013 14:10, schrieb Ramkumar Ramachandra: > + else if (!strcmp(formatp, "track") && > + !prefixcmp(name, "upstream")) { > + char buf[40]; > + > + if (!upstream_present) > +

Re: [PATCH 3/3] for-each-ref: introduce %(upstream:track[short])

2013-09-27 Thread Phil Hord
On Fri, Sep 27, 2013 at 8:10 AM, Ramkumar Ramachandra wrote: > Introduce %(upstream:track) to display "[ahead M, behind N]" and > %(upstream:trackshort) to display "=", ">", "<", or "<>" > appropriately (inspired by contrib/completion/git-prompt.sh). > > Now you can use the following format in for

[PATCH 3/3] for-each-ref: introduce %(upstream:track[short])

2013-09-27 Thread Ramkumar Ramachandra
Introduce %(upstream:track) to display "[ahead M, behind N]" and %(upstream:trackshort) to display "=", ">", "<", or "<>" appropriately (inspired by contrib/completion/git-prompt.sh). Now you can use the following format in for-each-ref: %C(green)%(refname:short)%C(reset)%(upstream:trackshort)

[PATCH 3/3] for-each-ref: introduce %(upstream:track[short])

2013-05-24 Thread Ramkumar Ramachandra
Introduce %(upstream:track) to display "[ahead M, behind N]" and %(upstream:trackshort) to display "=", ">", "<", or "<>" appropriately (inspired by the contrib/completion/git-prompt.sh). Now you can use the following format in for-each-ref: %C(red)%(HEAD)%C(reset) %C(green)%(refname:short)%C(