Re: [PATCH] Add new @ shortcut for HEAD

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

 



On Tue, Apr 30, 2013 at 12:54 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Jonathan Nieder <jrnieder@xxxxxxxxx> writes:
>
>> Junio C Hamano wrote:
>>> Felipe Contreras <felipe.contreras@xxxxxxxxx> writes:
>>
>>>> Never-mind, now I see the difference, still, I don't think it's
>>>> relevant for this patch.
>>>
>>> I don't either. With the precedence of @{u}, @ does not need to have
>>> anything to do with a reflog. It is just a random letter that casts
>>> a magic spell.
>>
>> I thought the convention was "^{...} is for operators that act on
>> objects, @{...} for operators that act on refs or symrefs".
>
> Almost.  You can ask "git rev-parse --symbolic-full-name" to see
> that @{-1} is still a ref, but @{1} is _not_ a ref (it is a concrete
> revision that you cannot run 'update-ref' on).

This has nothing to do with this documentation.

diff --git a/Documentation/git-check-ref-format.txt
b/Documentation/git-check-ref-format.txt
index ec1739a..4764975 100644
--- a/Documentation/git-check-ref-format.txt
+++ b/Documentation/git-check-ref-format.txt
@@ -52,7 +52,7 @@ Git imposes the following rules on how references are named:

 . They cannot end with a dot `.`.

-. They cannot contain a sequence `@{`.
+. They cannot contain a sequence `@{` or end with `@`.

 . They cannot contain a `\`.

diff --git a/refs.c b/refs.c
index de2d8eb..99ac4f6 100644
--- a/refs.c
+++ b/refs.c
@@ -95,6 +95,8 @@ int check_refname_format(const char *refname, int flags)

        if (refname[component_len - 1] == '.')
                return -1; /* Refname ends with '.'. */
+       if (refname[component_len - 1] == '@')
+               return -1; /* Refname ends with '@'. */
        if (!(flags & REFNAME_ALLOW_ONELEVEL) && component_count < 2)
                return -1; /* Refname has only one component. */
        return 0;

% git update-ref master@ master
fatal: Cannot lock the ref 'master@'.

-- 
Felipe Contreras
--
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]