[PATCH 0/2] @{u} updates
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:48:04
Earlier I wondered if the approach Dscho's patch takes to teach the new
@{upstream} syntax to substitute_branch_name() (hence dwim_ref()) without
teaching it to interpret_branch_name() (hence strbuf_branchname()) was a
bad idea. I thought about this a bit more; there are some downsides for
not doing so.
The first patch adds a handful of tests that show why strbuf_branchname()
callers may also want to learn about the new syntax. The second patch
moves the logic to interpret_branch_name() to make them happier.
The name of the key function was changed from tracked_suffix() to
upstream_mark(), not only because the syntax talks about @{upstream}, but
because the parsing needs to recognize the @{u}/@{upstream} mark at the
beginning of the given string (that is a suffix to some other string), and
strip it (the earlier code wanted @{u} to be at the very end but the
callers need to have it at the beginning).
Junio C Hamano (2):
t1506: more test for @{upstream} syntax
Teach @{upstream} syntax to strbuf_branchanme()
sha1_name.c | 116 ++++++++++++++++++++++++++---------------
t/t1506-rev-parse-upstream.sh | 41 ++++++++++++++
2 files changed, 115 insertions(+), 42 deletions(-)