{"thread":{"id":"8490","subject":"Re: git does the wrong thing with ambiguous names","startedAt":"2007-06-07T22:51:08Z","lastAt":"2007-06-07T22:51:08Z","messageCount":1,"participants":["Brandon Casey"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"44273","messageId":"46688BDC.6000506@nrlssc.navy.mil","threadId":"8490","inReplyTo":null,"subject":"Re: git does the wrong thing with ambiguous names","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2007-06-07T22:51:08Z","receivedAt":"2007-06-07T22:51:08Z","isPatch":false,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"\nDidn't hit reply-all...\n\nBrandon Casey wrote:\n> Alex Riesen wrote:\n>> Alex Riesen, Thu, Jun 07, 2007 01:33:27 +0200:\n>>> Alex Riesen, Thu, Jun 07, 2007 00:58:26 +0200:\n>>>> Brandon Casey, Thu, Jun 07, 2007 00:13:48 +0200:\n> [snip]\n>> This one is much shorter and less friendly. Suggested by Junio on irc.\n>> It makes checkout always prefer a branch.\n>>\n>> diff --git a/git-checkout.sh b/git-checkout.sh\n>> index 6b6facf..282c84f 100755\n>> --- a/git-checkout.sh\n>> +++ b/git-checkout.sh\n>> @@ -67,6 +67,8 @@ while [ \"$#\" != \"0\" ]; do\n>>              new_name=\"$arg\"\n>>              if git-show-ref --verify --quiet -- \"refs/heads/$arg\"\n>>              then\n>> +                rev=$(git-rev-parse --verify \"refs/heads/$arg^0\" \n>> 2>/dev/null)\n>> +                new=\"$rev\"\n>>                  branch=\"$arg\"\n>>              fi\n>>          elif rev=$(git-rev-parse --verify \"$arg^{tree}\" 2>/dev/null)\n>>\n> \n> This doesn't work.\n\nsorry, scratch that. It does work.\n\nThunderbird turned $arg _hat_ 0 into $arg _superscript_ 0, which became\n$arg0 when I copy/pasted. And I didn't catch it. Again, apologies.\n\nI think this is the intuitive behavior, prefer branch over tag. though I\nthink a warning or refusal to switch would be better (but more\ncomplicated, and I don't know how to do it).\n\nA quick run through of some other porcelain commands shows they prefer tag:\ngit log\ngit show\ngit diff\n\n-brandon\n"}]}