Re: with git update-ref?
- From
- Phillip Wood <phillip.wood123@gmail.com>
- Date
- Oct 13, 2024, 09:34 UTC
- Message-ID
- <f7a7046c-020a-4365-baf4-49184bd2c60b@gmail.com>
- In-Reply-To
- <xmqqa5facosb.fsf@gitster.g>
On 11/10/2024 22:28, Junio C Hamano wrote:
Show 21 quoted lines
> "Bence Ferdinandy" <bence@ferdinandy.com> writes: > >> On Fri Oct 11, 2024 at 22:56, Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com> wrote: >>> `ref: refs/remotes/origin/test`? (space after colon) >> >> I tried a couple of variations and no: >> >> ❯ git update-ref --no-deref refs/remotes/origin/HEAD 'ref: refs/remotes/origin/test' >> fatal: ref: refs/remotes/origin/test: not a valid SHA1 >> ❯ git update-ref refs/remotes/origin/HEAD 'ref: refs/remotes/origin/test' >> fatal: ref: refs/remotes/origin/test: not a valid SHA1 >> ❯ git update-ref --no-deref refs/remotes/origin/HEAD 'ref:refs/remotes/origin/test' >> fatal: ref:refs/remotes/origin/test: not a valid SHA1 >> ❯ git update-ref refs/remotes/origin/HEAD 'ref:refs/remotes/origin/test' >> fatal: ref:refs/remotes/origin/test: not a valid SHA1 >> >> I guess the intended way of doing this is via git symbolic-ref anyway, but I'm >> curious if this should work somehow or I'm misinterpreting the meaning of that >> sentence. > > I do not think update-ref is a tool to modify a symbolic-ref.
Didn't we add support for symbolic-refs to update-ref with 'kn/update-ref-symref'? Maybe it only works with --stdin? I've Cc'd Karthik for clarification on how it is supposed to work.
Best Wishes
Phillip
Show 18 quoted lines
> Moreover, the mention of "ref:" is meant to be for those who are > overly curious for their own good and go peek into their .git/ > directory; script writers should not have to know such an > implementation detail. > > : ask what the current state is. > $ git symbolic-ref refs/remotes/origin/HEAD > fatal: ref refs/remotes/origin/HEAD is not a symbolic ref > > : set it > $ git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main > > : inspect the result > $ git symbolic-ref refs/remotes/origin/HEAD > refs/remotes/origin/master > > Thanks. >