]> git.proxmox.com Git - libgit2.git/commit - src/refs.c
Make symbolic ref target validation optional
authorRichard Ipsum <richardipsum@fastmail.co.uk>
Sat, 27 Aug 2016 12:42:53 +0000 (13:42 +0100)
committerRichard Ipsum <richardipsum@fastmail.co.uk>
Sat, 27 Aug 2016 17:25:02 +0000 (18:25 +0100)
commit452bf57cbe665768810f2597aba50b9afc9509a7
treec78160b18264df008d5cb35d9b1bf3d88033ab82
parent5671e81fdd68899b1646ae891b07a2c13d9faba7
Make symbolic ref target validation optional

Introduce GIT_OPT_ENABLE_SYMBOLIC_REF_TARGET_VALIDATION option.
Setting this option to 0 allows
validation of a symbolic ref's target to be bypassed.
This option is enabled by default.

This mechanism is added primarily to address a discrepancy between git
behaviour and libgit2 behaviour, whereby the former allows the symbolic
ref target to carry an arbitrary string and the latter does not, so:

    $ git symbolic-ref refs/heads/foo bar
    $ cat .git/refs/heads/foo
    ref: bar

where as attempting the same via libgit2 raises an error:

    The given reference name 'bar' is not valid

this mechanism also allows those that might want to make use of
git's more lenient treatment of symbolic ref targets to do so.
include/git2/common.h
src/refs.c
src/refs.h
src/settings.c