Re: [PATCH 4/6] remote prune: warn dangling symrefs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 11, 2009 at 01:35:47PM -0500, Jeff King wrote:

> 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux