{"thread":{"id":"2866","subject":"[PATCH] Remove misguided branch disambiguation.","startedAt":"2005-12-17T09:37:38Z","lastAt":"2005-12-18T03:03:33Z","messageCount":3,"participants":["Junio C Hamano","Alex Riesen"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"13766","messageId":"7virto12u5.fsf@assigned-by-dhcp.cox.net","threadId":"2866","inReplyTo":null,"subject":"[PATCH] Remove misguided branch disambiguation.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-12-17T09:37:38Z","receivedAt":"2005-12-17T09:37:38Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"This removes the misguided attempt to refuse processing a branch\nname xyzzy and insist it to be given as either heads/xyzzy or\ntags/xyzzy when a tag xyzzy exists.  There was no reason to do\nso --- the search order was predictable and well defined, so if\nthe user says xyzzy we should have taken the tag xyzzy in such a\ncase without complaining.\n\nThis incidentally fixes another subtle bug related to this.  If\nsuch a duplicate branch/tag name happened to be a unique valid\nprefix of an existing commit object name (say, \"beef\"), we did\nnot take the tag \"beef\" but after complaining used the commit\nobject whose name started with beef.\n\nAnother problem this fixes while introducing some confusion is\nthat there is no longer a reason to forbid a branch name HEAD\nanymore.  In other words, now \"git pull . ref1:HEAD\" would work\nas expected, once we revert \"We do not like HEAD branch\" patch.\nIt creates \"HEAD\" branch under ${GIT_DIR-.git}/refs/heads (or\nfast-forwards if already exists) using the tip of ref1 branch\nfrom the current repository, and merges it into the current\nbranch.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n\n---\n\n sha1_name.c |   33 +++------------------------------\n 1 files changed, 3 insertions(+), 30 deletions(-)\n\na012e1b2b5218729e148befd0705bd52962ac272\ndiff --git a/sha1_name.c b/sha1_name.c\nindex bf8f0f0..49e2cc3 100644\n--- a/sha1_name.c\n+++ b/sha1_name.c\n@@ -238,7 +238,6 @@ static int get_sha1_basic(const char *st\n \t\tNULL\n \t};\n \tconst char **p;\n-\tint found = 0;\n \n \tif (len == 40 && !get_sha1_hex(str, sha1))\n \t\treturn 0;\n@@ -249,36 +248,10 @@ static int get_sha1_basic(const char *st\n \n \tfor (p = prefix; *p; p++) {\n \t\tchar *pathname = git_path(\"%s/%.*s\", *p, len, str);\n-\n-\t\tif (!read_ref(pathname, sha1)) {\n-\t\t\t/* Must be unique; i.e. when heads/foo and\n-\t\t\t * tags/foo are both present, reject \"foo\".\n-\t\t\t */\n-\t\t\tif (1 < found++)\n-\t\t\t\treturn -1;\n-\t\t}\n-\n-\t\t/* We want to allow .git/description file and\n-\t\t * \"description\" branch to exist at the same time.\n-\t\t * \"git-rev-parse description\" should silently skip\n-\t\t * .git/description file as a candidate for\n-\t\t * get_sha1().  However, having garbage file anywhere\n-\t\t * under refs/ is not OK, and we would not have caught\n-\t\t * ambiguous heads and tags with the above test.\n-\t\t */\n-\t\telse if (**p && !access(pathname, F_OK)) {\n-\t\t\t/* Garbage exists under .git/refs */\n-\t\t\treturn error(\"garbage ref found '%s'\", pathname);\n-\t\t}\n-\t}\n-\tswitch (found) {\n-\tcase 0:\n-\t\treturn -1;\n-\tcase 1:\n-\t\treturn 0;\n-\tdefault:\n-\t\treturn error(\"ambiguous refname '%.*s'\", len, str);\n+\t\tif (!read_ref(pathname, sha1))\n+\t\t\treturn 0;\n \t}\n+\treturn -1;\n }\n \n static int get_sha1_1(const char *name, int len, unsigned char *sha1);\n-- \n0.99.9.GIT\n"},{"id":"13769","messageId":"20051218000636.GA20874@steel.home","threadId":"2866","inReplyTo":"7virto12u5.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Remove misguided branch disambiguation.","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2005-12-18T00:06:36Z","receivedAt":"2005-12-18T00:06:36Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Junio C Hamano, Sat, Dec 17, 2005 10:37:38 +0100:\n> This removes the misguided attempt to refuse processing a branch\n> name xyzzy and insist it to be given as either heads/xyzzy or\n> tags/xyzzy when a tag xyzzy exists.  There was no reason to do\n> so --- the search order was predictable and well defined, so if\n> the user says xyzzy we should have taken the tag xyzzy in such a\n> case without complaining.\n\nRight. The test 'Ambiguous' in t0000-basic is redundant now, btw\n"},{"id":"13776","messageId":"7v4q57yum2.fsf@assigned-by-dhcp.cox.net","threadId":"2866","inReplyTo":"20051218000636.GA20874@steel.home","subject":"Re: [PATCH] Remove misguided branch disambiguation.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-12-18T03:03:33Z","receivedAt":"2005-12-18T03:03:33Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alex Riesen <raa.lkml@gmail.com> writes:\n\n> Right. The test 'Ambiguous' in t0000-basic is redundant now, btw\n\nI reverted that in jc/tail branch (part of pu branch) as well.\n"}]}