summaryrefslogtreecommitdiff
path: root/include/git2/common.h
diff options
context:
space:
mode:
authorRichard Ipsum <richardipsum@fastmail.co.uk>2016-08-27 13:42:53 +0100
committerRichard Ipsum <richardipsum@fastmail.co.uk>2016-08-27 18:25:02 +0100
commit452bf57cbe665768810f2597aba50b9afc9509a7 (patch)
treec78160b18264df008d5cb35d9b1bf3d88033ab82 /include/git2/common.h
parent5671e81fdd68899b1646ae891b07a2c13d9faba7 (diff)
downloadlibgit2-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 'include/git2/common.h')
-rw-r--r--include/git2/common.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/git2/common.h b/include/git2/common.h
index 18abe46b3..02d263048 100644
--- a/include/git2/common.h
+++ b/include/git2/common.h
@@ -157,6 +157,7 @@ typedef enum {
GIT_OPT_SET_SSL_CERT_LOCATIONS,
GIT_OPT_SET_USER_AGENT,
GIT_OPT_ENABLE_STRICT_OBJECT_CREATION,
+ GIT_OPT_ENABLE_SYMBOLIC_REF_TARGET_VALIDATION,
GIT_OPT_SET_SSL_CIPHERS,
GIT_OPT_GET_USER_AGENT,
} git_libgit2_opt_t;
@@ -270,6 +271,18 @@ typedef enum {
* > example, when this is enabled, the parent(s) and tree inputs
* > will be validated when creating a new commit. This defaults
* > to disabled.
+ *
+ * * opts(GIT_OPT_ENABLE_SYMBOLIC_REF_TARGET_VALIDATION, int enabled)
+ *
+ * > Validate the target of a symbolic ref when creating it.
+ * > For example, 'foobar' is not a valid ref,
+ * > therefore 'foobar' is not a valid target
+ * > for a symbolic ref by default,
+ * > where as 'refs/heads/foobar' is.
+ * > Disabling this bypasses validation so that an arbitrary
+ * > strings such as 'foobar' can be used for a symbolic ref target.
+ * > This defaults to enabled.
+ *
* * opts(GIT_OPT_SET_SSL_CIPHERS, const char *ciphers)
*
* > Set the SSL ciphers use for HTTPS connections.