refs.c: create a public function for is_refname_available

Export a generic is_refname_available() function. We will need this
as a public shared function later when we add additional refs backends
since we want to keep using the same rules for ref naming across
all backends.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
refs-common.c: create a file to host all common refs code

Create refs-common.c which will hold all backend agnostic refs code.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
refs-common.c: move update_ref to refs-common.c

This change moves update_ref() to the refs-common.c file since this function
does not contain any backend specific code.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
refs-common.c: move delete_ref to the common code

This change moves delete_ref() to the refs-common.c file since this function
does not contain any backend specific code.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
refs-common.c: move rename_ref to the common code

This change moves rename_ref() to the refs-common.c file since this function
does not contain any backend specific code.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
refs-common.c: move read_ref_at to the refs common file

This change moves read_ref_at() to the refs-common.c file since this function
does not contain any backend specific code.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
refs-common.c: move the hidden refs functions to the common code

This change moves the hidden refs functions to the refs-common.c file since
these functions do not contain any backend specific code.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
refs-common.c: move dwim and friend functions to refs common

These functions do not contain any backend specific code so we can move
them to the common code and share across all backends.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
refs-common.c: move warn_if_dangling_symref* to refs-common

These functions do not use any backend specific code so we can move
them to the common code.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
refs-common.c: move read_ref, read_ref_full and ref_exists to common

These functions do not depend on the backend implementation so we
can move them to the common code.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
refs-common.c: move resolve_refdup to common

This function can be shared across all refs backends so move it
to the common code.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
refs-common.c: move check_refname_component to the common code

This function does not contain any backend specific code so we
can move it to the common code.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
refs-common.c: move is_branch to the common code

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
refs-common.c: move names_conflict to the common code

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
refs-common.c: move prettify_refname to the common code

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
refs-common.c: move ref iterators to the common code

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
refs.c: add a backend method structure with transaction functions

Add a ref structure for backend methods. Start by adding method pointers
for the transaction functions.

Rename the existing transaction functions to files_* and make them static.
Add new transaction functions that just pass through to the appropriate
methods for the backend.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
refs.c: add reflog backend methods

Add methods for the reflog functions.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
refs.c: add methods for misc ref operations

Add ref backend methods for
	resolve_ref_unsafe_fn resolve_ref_unsafe;
	is_refname_available_fn is_refname_available;
	pack_refs_fn pack_refs;
	peel_ref_fn peel_ref;
	create_symref_fn create_symref;
	resolve_gitlink_ref_fn resolve_gitlink_ref;

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
refs.c: add methods for head_ref*

Add methods for the head_ref* functions.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>