Skip to content
  • Jeff King's avatar
    interpret_branch_name: find all possible @-marks · 9892d5d4
    Jeff King authored and Junio C Hamano's avatar Junio C Hamano committed
    When we parse a string like "foo@{upstream}", we look for
    the first "@"-sign, and check to see if it is an upstream
    mark. However, since branch names can contain an @, we may
    also see "@foo
    
    @{upstream}". In this case, we check only the
    first @, and ignore the second. As a result, we do not find
    the upstream.
    
    We can solve this by iterating through all @-marks in the
    string, and seeing if any is a legitimate upstream or
    empty-at mark.
    
    Another strategy would be to parse from the right-hand side
    of the string. However, that does not work for the
    "empty_at" case, which allows "@@{upstream}". We need to
    find the left-most one in this case (and we then recurse as
    "HEAD@{upstream}").
    
    Signed-off-by: default avatarJeff King <peff@peff.net>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    9892d5d4