refs.c: make unlock_ref static

We no longer need to export unlock_ref. Make the function static.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
refs.c: make close_ref static

We no longer need to export close_ref. Make the function static.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
refs.c: make commit_ref static

We no longer need to export commit_ref. Make the function static.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
refs.c: remove the function lock_any_ref_for_update

We no longer need the function lock_any_ref_for_update so lets remove it.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
refs.c: make struct ref_lock private to refs.c

We no longer need to expose the ref_lock structure to any external callers.
Make it private to refs.c.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
refs.c: allow passing raw git_committer_info as email to _update_reflog

In many places in the code we do not have access to the individual fields
in the committer data. Instead we might only have access to prebaked data
such as what is returned by git_committer_info() containing a string
that consists of email, timestamp, zone etc.

This makes it inconvenient to use transaction_update_reflog since it means you
would have to first parse git_committer_info before you can call update_reflog.

Add a new flag UPDATE_REFLOG_EMAIL_IS_COMMITTER to _update_reflog to tell it
that what we pass in as email is already the fully baked committer string
we can use as-is.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
refs.c: move ref_update and other definitions to earlier in the file

Move the struct ref_update definition and some enums to earlier in the file.
This does not change any actual code or definitions but just moves them
to a different place in the code since we will soon reference some of these
from the rename_ref function.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
refs.c: use the transaction to manage the reflog in rename_refs

We have a transaction in rename_ref to managing the ref during the rename.
Use this transaction to manage the changes to the reflog too.
This now means that rename_ref is almost completely agnostic about how refs
storage is implemented and should be easier to migrate if/when we allow a
different store for refs, such as a database.

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