Revert "Add new @ shortcut for HEAD"
This reverts commit cdfd94837b27c220f70f032b596ea993d195488f, as it does not just apply to "@" (and forms with modifiers like @{u} applied to it), but also affects e.g. "refs/heads/@/foo", which it shouldn't. The basic idea of giving a short-hand might be good, and the topic can be retried later, but let's revert to avoid affecting existing use cases for now for the upcoming release.
Junio C Hamano committed
Aug 14, 2013 at 10:57 UTC
2c2b6646c2723459dbd334c7ced6f77ffb0d596e
5 files changed
-28
Documentation/git-check-ref-format.txt
-2
@@ -54,8 +54,6 @@ Git imposes the following rules on how references are named:
54
55
. They cannot contain a sequence `@{`.
56
57
-. They cannot be the single character `@`.
58
-
57
. They cannot contain a `\`.
58
59
These rules make it easy for shell script based tools to parse
Documentation/revisions.txt
-3
@@ -58,9 +58,6 @@ the '$GIT_DIR/refs' directory or from the '$GIT_DIR/packed-refs' file.
58
While the ref name encoding is unspecified, UTF-8 is preferred as
59
some output processing may assume ref names in UTF-8.
60
61
-'@'::
62
- '@' alone is a shortcut for 'HEAD'.
63
-
61
'<refname>@\{<date>\}', e.g. 'master@\{yesterday\}', 'HEAD@\{5 minutes ago\}'::
62
A ref followed by the suffix '@' with a date specification
63
enclosed in a brace
refs.c
-4
@@ -72,10 +72,6 @@ int check_refname_format(const char *refname, int flags)
72
{
73
int component_len, component_count = 0;
74
75
- if (!strcmp(refname, "@"))
76
- /* Refname is a single character '@'. */
77
- return -1;
78
-
75
while (1) {
76
/* We are at the start of a path component. */
77
component_len = check_refname_component(refname, flags);
sha1_name.c
-17
@@ -1004,17 +1004,6 @@ int get_sha1_mb(const char *name, unsigned char *sha1)
1004
return st;
1005
}
1006
1007
-/* parse @something syntax, when 'something' is not {.*} */
1008
-static int interpret_empty_at(const char *name, int namelen, int len, struct strbuf *buf)
1009
-{
1010
- if (len || name[1] == '{')
1011
- return -1;
1012
-
1013
- strbuf_reset(buf);
1014
- strbuf_add(buf, "HEAD", 4);
1015
- return 1;
1016
-}
1017
-
1007
static int reinterpret(const char *name, int namelen, int len, struct strbuf *buf)
1008
{
1009
/* we have extra data, which might need further processing */
@@ -1077,15 +1066,9 @@ int interpret_branch_name(const char *name, struct strbuf *buf)
1066
cp = strchr(name, '@');
1067
if (!cp)
1068
return -1;
1080
-
1081
- len = interpret_empty_at(name, namelen, cp - name, buf);
1082
- if (len > 0)
1083
- return reinterpret(name, namelen, len, buf);
1084
-
1069
tmp_len = upstream_mark(cp, namelen - (cp - name));
1070
if (!tmp_len)
1071
return -1;
1088
-
1072
len = cp + tmp_len - name;
1073
cp = xstrndup(name, cp - name);
1074
upstream = branch_get(*cp ? cp : NULL);
t/t1508-at-combinations.sh
-2
@@ -55,8 +55,6 @@ check "HEAD@{u}" ref refs/heads/upstream-branch
55
check "@{u}@{1}" commit upstream-one
56
check "@{-1}@{u}" ref refs/heads/master
57
check "@{-1}@{u}@{1}" commit master-one
58
-check "@" commit new-two
59
-check "@@{u}" ref refs/heads/upstream-branch
58
nonsense "@{u}@{-1}"
59
nonsense "@{0}@{0}"
60
nonsense "@{1}@{u}"