Karthik Nayak [off-list ref] writes:
On Tue, Nov 15, 2016 at 11:12 PM, Junio C Hamano [off-list ref] wrote:
quoted
Jacob Keller [off-list ref] writes:
...
I think you are going in the right direction. I had a similar
thought but built around a different axis. I.e. if strip=1 strips
one from the left, perhaps we want to have rstrip=1 that strips one
from the right, and also strip=-1 to mean strip everything except
one from the left and so on?
...
If we do implement strip with negative numbers, it definitely
would be neat, but to get the desired feature which I've mentioned
below, we'd need to call strip twice, i.e
to get remotes from /refs/foo/abc/xyz we'd need to do
strip=1,strip=-1, which could be
done but ...
... would be unnecessary if this is the only use case:
strbuf_addf(&fmt,
"%%(if:notequals=remotes)%%(refname:base)%%(then)%s%%(else)%s%%(end)",
local.buf, remote.buf);
You can "strip to leave only 2 components" and compare the result
with refs/remotes instead, no?
Hey,
On Fri, Nov 18, 2016 at 12:05 AM, Junio C Hamano [off-list ref] wrote:
Karthik Nayak [off-list ref] writes:
quoted
On Tue, Nov 15, 2016 at 11:12 PM, Junio C Hamano [off-list ref] wrote:
quoted
Jacob Keller [off-list ref] writes:
...
I think you are going in the right direction. I had a similar
thought but built around a different axis. I.e. if strip=1 strips
one from the left, perhaps we want to have rstrip=1 that strips one
from the right, and also strip=-1 to mean strip everything except
one from the left and so on?
...
quoted
If we do implement strip with negative numbers, it definitely
would be neat, but to get the desired feature which I've mentioned
below, we'd need to call strip twice, i.e
to get remotes from /refs/foo/abc/xyz we'd need to do
strip=1,strip=-1, which could be
done but ...
... would be unnecessary if this is the only use case:
quoted
strbuf_addf(&fmt,
"%%(if:notequals=remotes)%%(refname:base)%%(then)%s%%(else)%s%%(end)",
local.buf, remote.buf);
You can "strip to leave only 2 components" and compare the result
with refs/remotes instead, no?
Of course, my only objective was that someone would find it useful to
have these two additional
atoms. So if you think it's unnecessary we could drop it entirely :D
--
Regards,
Karthik Nayak
On Thu, Nov 17, 2016 at 11:33 PM, Karthik Nayak [off-list ref] wrote:
Hey,
On Fri, Nov 18, 2016 at 12:05 AM, Junio C Hamano [off-list ref] wrote:
quoted
Karthik Nayak [off-list ref] writes:
quoted
On Tue, Nov 15, 2016 at 11:12 PM, Junio C Hamano [off-list ref] wrote:
quoted
Jacob Keller [off-list ref] writes:
...
I think you are going in the right direction. I had a similar
thought but built around a different axis. I.e. if strip=1 strips
one from the left, perhaps we want to have rstrip=1 that strips one
from the right, and also strip=-1 to mean strip everything except
one from the left and so on?
...
quoted
If we do implement strip with negative numbers, it definitely
would be neat, but to get the desired feature which I've mentioned
below, we'd need to call strip twice, i.e
to get remotes from /refs/foo/abc/xyz we'd need to do
strip=1,strip=-1, which could be
done but ...
... would be unnecessary if this is the only use case:
quoted
strbuf_addf(&fmt,
"%%(if:notequals=remotes)%%(refname:base)%%(then)%s%%(else)%s%%(end)",
local.buf, remote.buf);
You can "strip to leave only 2 components" and compare the result
with refs/remotes instead, no?
Of course, my only objective was that someone would find it useful to
have these two additional
atoms. So if you think it's unnecessary we could drop it entirely :D
--
Regards,
Karthik Nayak
I think having strip and rstrip make sense, (along with support for
negative numbers) I don't think we need to make them work together
unless someone is interested, since we can use strip=-2 to get the
behavior we need today.
Thanks,
Jake