Add a docstring for update_ref(), emphasizing its similarity to ref_transaction_update(). Rename its parameters to match those of ref_transaction_update(). Signed-off-by: Michael Haggerty <mhagger@xxxxxxxxxxxx> --- refs.c | 8 ++++---- refs.h | 15 +++++++++++---- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/refs.c b/refs.c index 0da680e..2651583 100644 --- a/refs.c +++ b/refs.c @@ -3739,8 +3739,8 @@ int ref_transaction_verify(struct ref_transaction *transaction, flags, NULL, err); } -int update_ref(const char *action, const char *refname, - const unsigned char *sha1, const unsigned char *oldval, +int update_ref(const char *msg, const char *refname, + const unsigned char *new_sha1, const unsigned char *old_sha1, int flags, enum action_on_err onerr) { struct ref_transaction *t; @@ -3748,8 +3748,8 @@ int update_ref(const char *action, const char *refname, t = ref_transaction_begin(&err); if (!t || - ref_transaction_update(t, refname, sha1, oldval, - flags, action, &err) || + ref_transaction_update(t, refname, new_sha1, old_sha1, + flags, msg, &err) || ref_transaction_commit(t, &err)) { const char *str = "update_ref failed for ref '%s': %s"; diff --git a/refs.h b/refs.h index 02d6e39..08abd2c 100644 --- a/refs.h +++ b/refs.h @@ -344,10 +344,17 @@ int ref_transaction_commit(struct ref_transaction *transaction, */ void ref_transaction_free(struct ref_transaction *transaction); -/** Lock a ref and then write its file */ -int update_ref(const char *action, const char *refname, - const unsigned char *sha1, const unsigned char *oldval, - int flags, enum action_on_err onerr); +/** + * Lock, update, and unlock a single reference. This function + * basically does a transaction containing a single call to + * ref_transaction_update(). The parameters to this function have the + * same meaning as the corresponding parameters to + * ref_transaction_update(). Handle errors as requested by the `onerr` + * argument. + */ +int update_ref(const char *msg, const char *refname, + const unsigned char *new_sha1, const unsigned char *old_sha1, + int flags, enum action_on_err onerr); extern int parse_hide_refs_config(const char *var, const char *value, const char *); extern int ref_is_hidden(const char *); -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html