Re: [PATCH 4/6] remote prune: warn dangling symrefs
- From
Jeff King <peff@peff.net>
- Date
- Feb 11, 2009, 18:42 UTC
- Message-ID
- <20090211184205.GA27859@coredump.intra.peff.net>
- In-Reply-To
- <20090211183547.GB21122@coredump.intra.peff.net>
On Wed, Feb 11, 2009 at 01:35:47PM -0500, Jeff King wrote:
Show 14 quoted lines
> Is the special case really about "this is HEAD", or is it about writing > versus reading? For example, in an empty repo, without this patch I now > get: > > $ git init && git show > warning: ignoring dangling symref HEAD. > fatal: bad default revision 'HEAD' > > which makes a lot of sense. But _writing_ to any dangling symref > shouldn't trigger a warning. > > Admittedly, we have gotten by without this warning until now, and I > doubt anyone will want to write to other symrefs that are branches to be > born, so I think in practice your patch is fine.
I looked into what it would take to fix this, and it's a little hairy. "git commit" calls:
if (get_sha1("HEAD", head_sha1))
initial_commit = 1;So it is fine with HEAD not resolving, but that intent is not passed to lower-level code. So we could add a "flags" field, but the callstack looks like:
dwim_ref get_sha1_basic get_sha1_1 get_sha1_with_mode get_sha1
all of which would need to pass the flag through, and all of which have tons of callers (though we could do the get_sha1_with_flags trick).
I don't know if it's worth it.
-Peff