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@xxxxxxxxxx> --- refs-common.c | 18 ++++++++++++++++++ refs.c | 19 ------------------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/refs-common.c b/refs-common.c index cb884b2..71ad358 100644 --- a/refs-common.c +++ b/refs-common.c @@ -25,3 +25,21 @@ int update_ref(const char *action, const char *refname, return 0; } +int delete_ref(const char *refname, const unsigned char *sha1, int delopt) +{ + struct ref_transaction *transaction; + struct strbuf err = STRBUF_INIT; + + transaction = transaction_begin(&err); + if (!transaction || + transaction_delete_sha1(transaction, refname, sha1, delopt, + sha1 && !is_null_sha1(sha1), NULL, &err) || + transaction_commit(transaction, &err)) { + error("%s", err.buf); + transaction_free(transaction); + strbuf_release(&err); + return 1; + } + transaction_free(transaction); + return 0; +} diff --git a/refs.c b/refs.c index eb66cf7..faf794c 100644 --- a/refs.c +++ b/refs.c @@ -2622,25 +2622,6 @@ static int delete_ref_loose(struct ref_lock *lock, int flag, struct strbuf *err) return 0; } -int delete_ref(const char *refname, const unsigned char *sha1, int delopt) -{ - struct ref_transaction *transaction; - struct strbuf err = STRBUF_INIT; - - transaction = transaction_begin(&err); - if (!transaction || - transaction_delete_sha1(transaction, refname, sha1, delopt, - sha1 && !is_null_sha1(sha1), NULL, &err) || - transaction_commit(transaction, &err)) { - error("%s", err.buf); - transaction_free(transaction); - strbuf_release(&err); - return 1; - } - transaction_free(transaction); - return 0; -} - struct rename_reflog_cb { struct ref_transaction *transaction; const char *refname; -- 2.0.1.553.geee1b3e -- 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