* `git-rev-parse master` not referred to by any ref?
@ 2007-08-26 13:45 J. Bruce Fields
2007-08-26 13:52 ` J. Bruce Fields
0 siblings, 1 reply; 6+ messages in thread
From: J. Bruce Fields @ 2007-08-26 13:45 UTC (permalink / raw)
To: git
Any idea how I got into this situation?:
git$ git rev-parse master
warning: refname 'master' is ambiguous.
407c0c87e15b3cf60347f4fc0bcdb4d239de4163
~/local/git$ git for-each-ref | grep master
32ebe844c689d6e13e9875a0feefedca8dc1c6eb commit refs/heads/master
e413074f1293e907d94af99330f0dd632a78b01f commit refs/remotes/linux-nfs/master
0058a33a8eb5a8bfcfc5f5e769a2517cff4b73f1 commit refs/remotes/origin/master
git$ git for-each-ref | grep 407c0
git$
--b.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: `git-rev-parse master` not referred to by any ref?
2007-08-26 13:45 `git-rev-parse master` not referred to by any ref? J. Bruce Fields
@ 2007-08-26 13:52 ` J. Bruce Fields
2007-08-26 14:06 ` J. Bruce Fields
0 siblings, 1 reply; 6+ messages in thread
From: J. Bruce Fields @ 2007-08-26 13:52 UTC (permalink / raw)
To: git
On Sun, Aug 26, 2007 at 09:45:21AM -0400, J. Bruce Fields wrote:
> Any idea how I got into this situation?:
>
> git$ git rev-parse master
> warning: refname 'master' is ambiguous.
> 407c0c87e15b3cf60347f4fc0bcdb4d239de4163
> ~/local/git$ git for-each-ref | grep master
> 32ebe844c689d6e13e9875a0feefedca8dc1c6eb commit refs/heads/master
> e413074f1293e907d94af99330f0dd632a78b01f commit refs/remotes/linux-nfs/master
> 0058a33a8eb5a8bfcfc5f5e769a2517cff4b73f1 commit refs/remotes/origin/master
> git$ git for-each-ref | grep 407c0
> git$
Oops, found it:
git$ cat .git/master
407c0c87e15b3cf60347f4fc0bcdb4d239de4163
--b.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: `git-rev-parse master` not referred to by any ref?
2007-08-26 13:52 ` J. Bruce Fields
@ 2007-08-26 14:06 ` J. Bruce Fields
2007-08-26 21:26 ` Junio C Hamano
0 siblings, 1 reply; 6+ messages in thread
From: J. Bruce Fields @ 2007-08-26 14:06 UTC (permalink / raw)
To: git
On Sun, Aug 26, 2007 at 09:52:51AM -0400, J. Bruce Fields wrote:
> On Sun, Aug 26, 2007 at 09:45:21AM -0400, J. Bruce Fields wrote:
> > Any idea how I got into this situation?:
> >
> > git$ git rev-parse master
> > warning: refname 'master' is ambiguous.
> > 407c0c87e15b3cf60347f4fc0bcdb4d239de4163
> > ~/local/git$ git for-each-ref | grep master
> > 32ebe844c689d6e13e9875a0feefedca8dc1c6eb commit refs/heads/master
> > e413074f1293e907d94af99330f0dd632a78b01f commit refs/remotes/linux-nfs/master
> > 0058a33a8eb5a8bfcfc5f5e769a2517cff4b73f1 commit refs/remotes/origin/master
> > git$ git for-each-ref | grep 407c0
> > git$
>
> Oops, found it:
>
> git$ cat .git/master
> 407c0c87e15b3cf60347f4fc0bcdb4d239de4163
(Somebody on irc pointed out that
git update-ref master 407c0c87e15b3cf60347f4fc0bcdb4d239de4163
The file's dated a couple weeks ago, so I don't remember, but I can
easily imagine that I could have typed that assuming it'd update
.git/refs/heads/master. OK!)
--b.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: `git-rev-parse master` not referred to by any ref?
2007-08-26 14:06 ` J. Bruce Fields
@ 2007-08-26 21:26 ` Junio C Hamano
2007-08-26 22:28 ` Shawn O. Pearce
2007-08-26 22:36 ` J. Bruce Fields
0 siblings, 2 replies; 6+ messages in thread
From: Junio C Hamano @ 2007-08-26 21:26 UTC (permalink / raw)
To: J. Bruce Fields; +Cc: git
"J. Bruce Fields" <bfields@fieldses.org> writes:
>> Oops, found it:
>>
>> git$ cat .git/master
>> 407c0c87e15b3cf60347f4fc0bcdb4d239de4163
It _might_ make it safer to refuse creating anything outside
refs/ if the name does not contain or ends with "HEAD" (or
perhaps names that have chars outside "[_A-Z]"), but that would
restrict future tools that might want to have HEAD-like files,
so I am a bit hesitant.
OTOH, a random file under .git/ does not count as a ref for the
purposes of fsck/prune, so it may make sense to teach
check_ref_format() about the same set of "special" names that
can appear directly under .git without being in refs/ hierarchy
(currently I think only "HEAD" and possibly "ORIG_HEAD" are in
that set).
BTW, git-merge.sh and git-reset.sh should use "git update-ref ORIG_HEAD"
instead of doing it by hand using "echo >$GIT_DIR/ORIG_HEAD".
Also, I *think* objects that are only reachable via ORIG_HEAD
are not considered as reachable by fsck/prune --- we probably
would want to fix this.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: `git-rev-parse master` not referred to by any ref?
2007-08-26 21:26 ` Junio C Hamano
@ 2007-08-26 22:28 ` Shawn O. Pearce
2007-08-26 22:36 ` J. Bruce Fields
1 sibling, 0 replies; 6+ messages in thread
From: Shawn O. Pearce @ 2007-08-26 22:28 UTC (permalink / raw)
To: Junio C Hamano; +Cc: J. Bruce Fields, git
Junio C Hamano <gitster@pobox.com> wrote:
> Also, I *think* objects that are only reachable via ORIG_HEAD
> are not considered as reachable by fsck/prune --- we probably
> would want to fix this.
Probably. But most users also have reflog enabled on HEAD in the
repository if they were to also have ORIG_HEAD there. In such a
case ORIG_HEAD is usually HEAD@{1}, which is considered reachable
by fsck/prune/repack.
--
Shawn.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: `git-rev-parse master` not referred to by any ref?
2007-08-26 21:26 ` Junio C Hamano
2007-08-26 22:28 ` Shawn O. Pearce
@ 2007-08-26 22:36 ` J. Bruce Fields
1 sibling, 0 replies; 6+ messages in thread
From: J. Bruce Fields @ 2007-08-26 22:36 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Sun, Aug 26, 2007 at 02:26:28PM -0700, Junio C Hamano wrote:
> It _might_ make it safer to refuse creating anything outside
> refs/ if the name does not contain or ends with "HEAD" (or
> perhaps names that have chars outside "[_A-Z]"), but that would
> restrict future tools that might want to have HEAD-like files,
> so I am a bit hesitant.
Sure.
I would have recovered faster if I'd known had a simple way to get a
list of all the refs that git-rev-parse finds. Is there an easy way? I
assume "find .git -name .." will miss packed refs. Both git-show-ref
and git-for-each-ref seem to ignore top-level references.
Maybe the "refname 'master' is ambiguous" warning could be modified to
list the choices? I don't know if that would be overkill.
--b.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-08-26 22:36 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-26 13:45 `git-rev-parse master` not referred to by any ref? J. Bruce Fields
2007-08-26 13:52 ` J. Bruce Fields
2007-08-26 14:06 ` J. Bruce Fields
2007-08-26 21:26 ` Junio C Hamano
2007-08-26 22:28 ` Shawn O. Pearce
2007-08-26 22:36 ` J. Bruce Fields
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox