git_reference_symbolic_create_matching

Conditionally create a new symbolic reference.

A symbolic reference is a reference name that refers to another reference name. If the other name moves, the symbolic name will move, too. As a simple example, the "HEAD" reference might refer to "refs/heads/master" while on the "master" branch of a repository.

The symbolic reference will be created in the repository and written to the disk. The generated reference object must be freed by the user.

Valid reference names must follow one of two patterns:

1. Top-level names must contain only capital letters and underscores, and must begin and end with a letter. (e.g. "HEAD", "ORIG_HEAD"). 2. Names prefixed with "refs/" can be almost anything. You must avoid the characters '~', '^', ':', '\\', '?', '[', and '*', and the sequences ".." and "@{" which have special meaning to revparse.

This function will return an error if a reference already exists with the given name unless force is true, in which case it will be overwritten.

The message for the reflog will be ignored if the reference does not belong in the standard set (HEAD, branches and remote-tracking branches) and it does not have a reflog.

It will return git_error_code.GIT_EMODIFIED if the reference's value at the time of updating does not match the one passed through current_value (i.e. if the ref has changed since the user read it).

extern (C) nothrow @nogc
int
git_reference_symbolic_create_matching

Parameters

out_ libgit2_d.types.git_reference**

Pointer to the newly created reference

repo libgit2_d.types.git_repository*

Repository where that reference will live

name const(char)*

The name of the reference

target const(char)*

The target of the reference

force int

Overwrite existing references

current_value const(char)*

The expected value of the reference when updating

log_message const(char)*

The one line long message to be appended to the reflog

Return Value

Type: int

0 on success, git_error_code.GIT_EEXISTS, git_error_code.GIT_EINVALIDSPEC, git_error_code.GIT_EMODIFIED or an error code

Meta