{"thread":{"id":"9649","subject":"`git-rev-parse master` not referred to by any ref?","startedAt":"2007-08-26T13:45:21Z","lastAt":"2007-08-26T22:36:10Z","messageCount":6,"participants":["J. Bruce Fields","Junio C Hamano","Shawn O. Pearce"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"51556","messageId":"20070826134521.GA20243@fieldses.org","threadId":"9649","inReplyTo":null,"subject":"`git-rev-parse master` not referred to by any ref?","fromName":"J. Bruce Fields","fromEmail":"bfields@fieldses.org","sentAt":"2007-08-26T13:45:21Z","receivedAt":"2007-08-26T13:45:21Z","isPatch":false,"sender":{"key":"bfields@citi.umich.edu","avatar":null},"body":"Any idea how I got into this situation?:\n\n\tgit$ git rev-parse master\n\twarning: refname 'master' is ambiguous.\n\t407c0c87e15b3cf60347f4fc0bcdb4d239de4163\n\t~/local/git$ git for-each-ref | grep master\n\t32ebe844c689d6e13e9875a0feefedca8dc1c6eb commit refs/heads/master\n\te413074f1293e907d94af99330f0dd632a78b01f commit refs/remotes/linux-nfs/master\n\t0058a33a8eb5a8bfcfc5f5e769a2517cff4b73f1 commit refs/remotes/origin/master\n\tgit$ git for-each-ref | grep 407c0\n\tgit$ \n\n--b.\n"},{"id":"51557","messageId":"20070826135251.GB20243@fieldses.org","threadId":"9649","inReplyTo":"20070826134521.GA20243@fieldses.org","subject":"Re: `git-rev-parse master` not referred to by any ref?","fromName":"J. Bruce Fields","fromEmail":"bfields@fieldses.org","sentAt":"2007-08-26T13:52:51Z","receivedAt":"2007-08-26T13:52:51Z","isPatch":false,"sender":{"key":"bfields@citi.umich.edu","avatar":null},"body":"On Sun, Aug 26, 2007 at 09:45:21AM -0400, J. Bruce Fields wrote:\n> Any idea how I got into this situation?:\n> \n> \tgit$ git rev-parse master\n> \twarning: refname 'master' is ambiguous.\n> \t407c0c87e15b3cf60347f4fc0bcdb4d239de4163\n> \t~/local/git$ git for-each-ref | grep master\n> \t32ebe844c689d6e13e9875a0feefedca8dc1c6eb commit refs/heads/master\n> \te413074f1293e907d94af99330f0dd632a78b01f commit refs/remotes/linux-nfs/master\n> \t0058a33a8eb5a8bfcfc5f5e769a2517cff4b73f1 commit refs/remotes/origin/master\n> \tgit$ git for-each-ref | grep 407c0\n> \tgit$ \n\nOops, found it:\n\n\tgit$ cat .git/master\n\t407c0c87e15b3cf60347f4fc0bcdb4d239de4163\n\n--b.\n"},{"id":"51558","messageId":"20070826140645.GC20243@fieldses.org","threadId":"9649","inReplyTo":"20070826135251.GB20243@fieldses.org","subject":"Re: `git-rev-parse master` not referred to by any ref?","fromName":"J. Bruce Fields","fromEmail":"bfields@fieldses.org","sentAt":"2007-08-26T14:06:45Z","receivedAt":"2007-08-26T14:06:45Z","isPatch":false,"sender":{"key":"bfields@citi.umich.edu","avatar":null},"body":"On Sun, Aug 26, 2007 at 09:52:51AM -0400, J. Bruce Fields wrote:\n> On Sun, Aug 26, 2007 at 09:45:21AM -0400, J. Bruce Fields wrote:\n> > Any idea how I got into this situation?:\n> > \n> > \tgit$ git rev-parse master\n> > \twarning: refname 'master' is ambiguous.\n> > \t407c0c87e15b3cf60347f4fc0bcdb4d239de4163\n> > \t~/local/git$ git for-each-ref | grep master\n> > \t32ebe844c689d6e13e9875a0feefedca8dc1c6eb commit refs/heads/master\n> > \te413074f1293e907d94af99330f0dd632a78b01f commit refs/remotes/linux-nfs/master\n> > \t0058a33a8eb5a8bfcfc5f5e769a2517cff4b73f1 commit refs/remotes/origin/master\n> > \tgit$ git for-each-ref | grep 407c0\n> > \tgit$ \n> \n> Oops, found it:\n> \n> \tgit$ cat .git/master\n> \t407c0c87e15b3cf60347f4fc0bcdb4d239de4163\n\n(Somebody on irc pointed out that\n\n\tgit update-ref master 407c0c87e15b3cf60347f4fc0bcdb4d239de4163\n\nThe file's dated a couple weeks ago, so I don't remember, but I can\neasily imagine that I could have typed that assuming it'd update\n.git/refs/heads/master.  OK!)\n\n--b.\n"},{"id":"51608","messageId":"7vir72ng1n.fsf@gitster.siamese.dyndns.org","threadId":"9649","inReplyTo":"20070826140645.GC20243@fieldses.org","subject":"Re: `git-rev-parse master` not referred to by any ref?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-08-26T21:26:28Z","receivedAt":"2007-08-26T21:26:28Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"J. Bruce Fields\" <bfields@fieldses.org> writes:\n\n>> Oops, found it:\n>> \n>> \tgit$ cat .git/master\n>> \t407c0c87e15b3cf60347f4fc0bcdb4d239de4163\n\nIt _might_ make it safer to refuse creating anything outside\nrefs/ if the name does not contain or ends with \"HEAD\" (or\nperhaps names that have chars outside \"[_A-Z]\"), but that would\nrestrict future tools that might want to have HEAD-like files,\nso I am a bit hesitant.\n\nOTOH, a random file under .git/ does not count as a ref for the\npurposes of fsck/prune, so it may make sense to teach \ncheck_ref_format() about the same set of \"special\" names that\ncan appear directly under .git without being in refs/ hierarchy\n(currently I think only \"HEAD\" and possibly \"ORIG_HEAD\" are in\nthat set).\n\nBTW, git-merge.sh and git-reset.sh should use \"git update-ref ORIG_HEAD\"\ninstead of doing it by hand using \"echo >$GIT_DIR/ORIG_HEAD\".\n\nAlso, I *think* objects that are only reachable via ORIG_HEAD\nare not considered as reachable by fsck/prune --- we probably\nwould want to fix this.\n"},{"id":"51612","messageId":"20070826222852.GC18160@spearce.org","threadId":"9649","inReplyTo":"7vir72ng1n.fsf@gitster.siamese.dyndns.org","subject":"Re: `git-rev-parse master` not referred to by any ref?","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-08-26T22:28:52Z","receivedAt":"2007-08-26T22:28:52Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Junio C Hamano <gitster@pobox.com> wrote:\n> Also, I *think* objects that are only reachable via ORIG_HEAD\n> are not considered as reachable by fsck/prune --- we probably\n> would want to fix this.\n\nProbably.  But most users also have reflog enabled on HEAD in the\nrepository if they were to also have ORIG_HEAD there.  In such a\ncase ORIG_HEAD is usually HEAD@{1}, which is considered reachable\nby fsck/prune/repack.\n\n-- \nShawn.\n"},{"id":"51613","messageId":"20070826223610.GB9116@fieldses.org","threadId":"9649","inReplyTo":"7vir72ng1n.fsf@gitster.siamese.dyndns.org","subject":"Re: `git-rev-parse master` not referred to by any ref?","fromName":"J. Bruce Fields","fromEmail":"bfields@fieldses.org","sentAt":"2007-08-26T22:36:10Z","receivedAt":"2007-08-26T22:36:10Z","isPatch":false,"sender":{"key":"bfields@citi.umich.edu","avatar":null},"body":"On Sun, Aug 26, 2007 at 02:26:28PM -0700, Junio C Hamano wrote:\n> It _might_ make it safer to refuse creating anything outside\n> refs/ if the name does not contain or ends with \"HEAD\" (or\n> perhaps names that have chars outside \"[_A-Z]\"), but that would\n> restrict future tools that might want to have HEAD-like files,\n> so I am a bit hesitant.\n\nSure.\n\nI would have recovered faster if I'd known had a simple way to get a\nlist of all the refs that git-rev-parse finds.  Is there an easy way?  I\nassume \"find .git -name ..\" will miss packed refs.  Both git-show-ref\nand git-for-each-ref seem to ignore top-level references.\n\nMaybe the \"refname 'master' is ambiguous\" warning could be modified to\nlist the choices?  I don't know if that would be overkill.\n\n--b.\n"}]}