This change moves update_ref() to the refs.c file since this function does not contain any backend specific code. Signed-off-by: Ronnie Sahlberg <sahlberg@xxxxxxxxxx> --- refs-be-files.c | 23 ----------------------- refs.c | 25 +++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/refs-be-files.c b/refs-be-files.c index 4a22513..eb66cf7 100644 --- a/refs-be-files.c +++ b/refs-be-files.c @@ -3576,29 +3576,6 @@ int transaction_delete_sha1(struct ref_transaction *transaction, old_sha1, flags, have_old, msg, err); } -int update_ref(const char *action, const char *refname, - const unsigned char *sha1, const unsigned char *oldval, - int flags, struct strbuf *e) -{ - struct ref_transaction *t; - struct strbuf err = STRBUF_INIT; - - t = transaction_begin(&err); - if (!t || - transaction_update_sha1(t, refname, sha1, oldval, flags, - !!oldval, action, &err) || - transaction_commit(t, &err)) { - const char *str = "update_ref failed for ref '%s': %s"; - - transaction_free(t); - if (e) - strbuf_addf(e, str, refname, err.buf); - strbuf_release(&err); - return 1; - } - return 0; -} - static int ref_update_compare(const void *r1, const void *r2) { const struct ref_update * const *u1 = r1; diff --git a/refs.c b/refs.c index 77492ff..5f6a1e7 100644 --- a/refs.c +++ b/refs.c @@ -1,3 +1,28 @@ /* * Common refs code for all backends. */ +#include "cache.h" +#include "refs.h" + +int update_ref(const char *action, const char *refname, + const unsigned char *sha1, const unsigned char *oldval, + int flags, struct strbuf *e) +{ + struct ref_transaction *t; + struct strbuf err = STRBUF_INIT; + + t = transaction_begin(&err); + if (!t || + transaction_update_sha1(t, refname, sha1, oldval, flags, + !!oldval, action, &err) || + transaction_commit(t, &err)) { + const char *str = "update_ref failed for ref '%s': %s"; + + transaction_free(t); + if (e) + strbuf_addf(e, str, refname, err.buf); + strbuf_release(&err); + return 1; + } + return 0; +} -- 2.0.1.552.g1af257a -- 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