diff options
author | Richard Ipsum <richardipsum@fastmail.co.uk> | 2016-08-27 13:42:53 +0100 |
---|---|---|
committer | Richard Ipsum <richardipsum@fastmail.co.uk> | 2016-08-27 18:25:02 +0100 |
commit | 452bf57cbe665768810f2597aba50b9afc9509a7 (patch) | |
tree | c78160b18264df008d5cb35d9b1bf3d88033ab82 /src/refs.h | |
parent | 5671e81fdd68899b1646ae891b07a2c13d9faba7 (diff) | |
download | libgit2-452bf57cbe665768810f2597aba50b9afc9509a7.tar.gz |
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.
Diffstat (limited to 'src/refs.h')
-rw-r--r-- | src/refs.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/refs.h b/src/refs.h index fda9532de..c4786ddb4 100644 --- a/src/refs.h +++ b/src/refs.h @@ -15,6 +15,8 @@ #include "buffer.h" #include "oid.h" +extern bool git_reference__enable_symbolic_ref_target_validation; + #define GIT_REFS_DIR "refs/" #define GIT_REFS_HEADS_DIR GIT_REFS_DIR "heads/" #define GIT_REFS_TAGS_DIR GIT_REFS_DIR "tags/" @@ -53,6 +55,7 @@ #define GIT_REFS_STASH_FILE GIT_REFS_DIR GIT_STASH_FILE #define GIT_REF_FORMAT__PRECOMPOSE_UNICODE (1u << 16) +#define GIT_REF_VALIDATION_DISABLE (1u << 15) #define GIT_REFNAME_MAX 1024 |