libgit2

git_refdb_backend

Version:

An instance for a custom backend

Signature

typedef struct git_refdb_backend { unsigned int version int (*)(int *, git_refdb_backend *, const char *) exists int (*)(git_reference **, git_refdb_backend *, const char *) lookup int (*)(git_reference_iterator **, struct git_refdb_backend *, const char *) iterator int (*)(git_refdb_backend *, const git_reference *, int, const git_signature *, const char *, const git_oid *, const char *) write int (*)(git_reference **, git_refdb_backend *, const char *, const char *, int, const git_signature *, const char *) rename int (*)(git_refdb_backend *, const char *, const git_oid *, const char *) del int (*)(git_refdb_backend *) compress int (*)(git_refdb_backend *, const char *) has_log int (*)(git_refdb_backend *, const char *) ensure_log void (*)(git_refdb_backend *) free int (*)(git_reflog **, git_refdb_backend *, const char *) reflog_read int (*)(git_refdb_backend *, git_reflog *) reflog_write int (*)(git_refdb_backend *, const char *, const char *) reflog_rename int (*)(git_refdb_backend *, const char *) reflog_delete int (*)(void **, git_refdb_backend *, const char *) lock int (*)(git_refdb_backend *, void *, int, int, const git_reference *, const git_signature *, const char *) unlock };

Members

unsigned int
version

The backend API version

int (*)(int *, git_refdb_backend *, const char *)
exists

Queries the refdb backend for the existence of a reference.

A refdb implementation must provide this function.

int (*)(git_reference **, git_refdb_backend *, const char *)
lookup

Queries the refdb backend for a given reference.

A refdb implementation must provide this function.

int (*)(git_reference_iterator **, struct git_refdb_backend *, const char *)
iterator

Allocate an iterator object for the backend.

A refdb implementation must provide this function.

int (*)(git_refdb_backend *, const git_reference *, int, const git_signature *, const char *, const git_oid *, const char *)
write

Writes the given reference to the refdb.

A refdb implementation must provide this function.

int (*)(git_reference **, git_refdb_backend *, const char *, const char *, int, const git_signature *, const char *)
rename

Rename a reference in the refdb.

A refdb implementation must provide this function.

int (*)(git_refdb_backend *, const char *, const git_oid *, const char *)
del

Deletes the given reference from the refdb.

If it exists, its reflog should be deleted as well.

A refdb implementation must provide this function.

int (*)(git_refdb_backend *)
compress

Suggests that the given refdb compress or optimize its references.

This mechanism is implementation specific. For on-disk reference databases, this may pack all loose references.

A refdb implementation may provide this function; if it is not provided, nothing will be done.

int (*)(git_refdb_backend *, const char *)
has_log

Query whether a particular reference has a log (may be empty)

Shall return 1 if it has a reflog, 0 it it doesn't and negative in case an error occurred.

A refdb implementation must provide this function.

int (*)(git_refdb_backend *, const char *)
ensure_log

Make sure a particular reference will have a reflog which will be appended to on writes.

A refdb implementation must provide this function.

void (*)(git_refdb_backend *)
free

Frees any resources held by the refdb (including the git_refdb_backend itself).

A refdb backend implementation must provide this function.

int (*)(git_reflog **, git_refdb_backend *, const char *)
reflog_read

Read the reflog for the given reference name.

A refdb implementation must provide this function.

int (*)(git_refdb_backend *, git_reflog *)
reflog_write

Write a reflog to disk.

A refdb implementation must provide this function.

int (*)(git_refdb_backend *, const char *, const char *)
reflog_rename

Rename a reflog.

A refdb implementation must provide this function.

int (*)(git_refdb_backend *, const char *)
reflog_delete

Remove a reflog.

A refdb implementation must provide this function.

int (*)(void **, git_refdb_backend *, const char *)
lock

Lock a reference.

A refdb implementation may provide this function; if it is not provided, the transaction API will fail to work.

int (*)(git_refdb_backend *, void *, int, int, const git_reference *, const git_signature *, const char *)
unlock

Unlock a reference.

Only one of target or symbolic_target will be set. success will be true if the reference should be update, false if the lock must be discarded.

A refdb implementation must provide this function if a lock implementation is provided.

Parameter To

Versions