On Wed, May 1, 2013 at 11:20 AM, Ramkumar Ramachandra
<artag...@gmail.com> wrote:
> First, make sure that check_refname_format() rejects the a refname
> beginning with a '@'.  Add a test to t1400 (update-ref) demonstrating
> that update-ref forbids the user from updating a ref named "@".
>
> Now, resolve_ref_unsafe() is built to resolve any refs that have a
> corresponding file inside $GITDIR.  Our "@" ref is a special
> pseudo-ref and does not have a filesystem counterpart.  So,
> hard-interpret "@" as "HEAD" and resolve .git/HEAD as usual.  This
> means that we can drop the 'git symbolic-ref @ HEAD' line in t1508
> (at-combinations), and everything will continue working as usual.
>
> If the user does manage to create a '.git/@' unsafely (via
> symbolic-ref or otherwise), it will be ignored.
>
> In practice, this means that you will now be able to do:
>
>     $ git show @~1
>     $ git log @^2
>
> Advertise these features in the tests and documentation.
>
> Signed-off-by: Ramkumar Ramachandra <artag...@gmail.com>
> ---
>  Documentation/git-check-ref-format.txt |  2 ++
>  Documentation/revisions.txt            |  8 ++++++--
>  refs.c                                 | 12 ++++++++++--
>  t/t1400-update-ref.sh                  |  3 +++
>  t/t1508-at-combinations.sh             |  7 ++++---
>  5 files changed, 25 insertions(+), 7 deletions(-)
>
> diff --git a/Documentation/git-check-ref-format.txt 
> b/Documentation/git-check-ref-format.txt
> index ec1739a..3de9adc 100644
> --- a/Documentation/git-check-ref-format.txt
> +++ b/Documentation/git-check-ref-format.txt
> @@ -52,6 +52,8 @@ Git imposes the following rules on how references are named:
>
>  . They cannot end with a dot `.`.
>
> +. They cannot be the single character `@`.
> +
>  . They cannot contain a sequence `@{`.
>
>  . They cannot contain a `\`.
> diff --git a/Documentation/revisions.txt b/Documentation/revisions.txt
> index d477b3f..9b2e653 100644
> --- a/Documentation/revisions.txt
> +++ b/Documentation/revisions.txt
> @@ -27,6 +27,10 @@ blobs contained in a commit.
>    When ambiguous, a '<refname>' is disambiguated by taking the
>    first match in the following rules:
>
> +  . '@' is a special pseudo-ref that refers to HEAD.

Does the user really cares if it's a pseudo-ref or not? Also, what
does it mean that "refers" to HEAD?

> An '@' followed
> +    by '\{' has no relationship to this and means something entirely
> +    different (see below).

If the user cares about that, the user can see that below, otherwise
there's no point in mentioning that. Just like there's no point in
mentioning that @{-N} means something totally different from @{N},
because the user can see that. If it didn't mean something different,
this bullet point wouldn't exist.

Cheers.

-- 
Felipe Contreras
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to