Re: [PATCH 7/8] refs: add 'update-symref' command to 'update-ref'

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

 



Chris Torek <chris.torek@xxxxxxxxx> writes:

> Meanwhile, for testing purposes I was curious as to what happens
> if you ask `git update-ref` to delete an existing symref, so after
> creating a test repository:
>
> $ git branch
> * main
>   symref -> main
> $ git update-ref --stdin
> delete refs/heads/symref
> $ git branch
>
> Whoops, this doesn't look good...
>

This is expected though. Remember that `git-update-ref(1)` by default
does dereferencing of symlinks. So in your case, 'refs/heads/symref' is
dereferenced to 'refs/heads/main' and when a delete command is issued,
'main' is deleted.

Try the same with the `git update-ref --no-deref --stdin` instead.

> Restoring the branch name (I had saved the hash ID Just In Case):
>
> $ echo d88ee82e6a5c29c95f712030f5efc9d43116ae79 > .git/refs/heads/main
>
> brings things back, after which this works properly:
>
> $ git branch -d symref
> Deleted branch symref (was refs/heads/main).
> $ git branch
> * main
>

Here you switch to using 'git-branch(1)' and that doesn't dereference by
default. So there is a difference in the two attempts.

Attachment: signature.asc
Description: PGP signature


[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