mirror of
https://github.com/git/git.git
synced 2026-05-25 11:25:06 +02:00
update-ref: move print_rejected_refs() up
The `print_rejected_refs()` function is used to print any rejected refs when using git-updated-ref(1) with the '--batch-updates' option. In the following commit, we'll need to use this function in another place, so move the function up to avoid a separate forward declaration. Signed-off-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
e99e98e600
commit
637989cdec
+22
-23
@@ -234,6 +234,28 @@ static int parse_next_oid(const char **next, const char *end,
|
||||
command, refname);
|
||||
}
|
||||
|
||||
static void print_rejected_refs(const char *refname,
|
||||
const struct object_id *old_oid,
|
||||
const struct object_id *new_oid,
|
||||
const char *old_target,
|
||||
const char *new_target,
|
||||
enum ref_transaction_error err,
|
||||
const char *details,
|
||||
void *cb_data UNUSED)
|
||||
{
|
||||
struct strbuf sb = STRBUF_INIT;
|
||||
|
||||
if (details && *details)
|
||||
error("%s", details);
|
||||
|
||||
strbuf_addf(&sb, "rejected %s %s %s %s\n", refname,
|
||||
new_oid ? oid_to_hex(new_oid) : new_target,
|
||||
old_oid ? oid_to_hex(old_oid) : old_target,
|
||||
ref_transaction_error_msg(err));
|
||||
|
||||
fwrite(sb.buf, sb.len, 1, stdout);
|
||||
strbuf_release(&sb);
|
||||
}
|
||||
|
||||
/*
|
||||
* The following five parse_cmd_*() functions parse the corresponding
|
||||
@@ -567,29 +589,6 @@ static void parse_cmd_abort(struct ref_transaction *transaction,
|
||||
report_ok("abort");
|
||||
}
|
||||
|
||||
static void print_rejected_refs(const char *refname,
|
||||
const struct object_id *old_oid,
|
||||
const struct object_id *new_oid,
|
||||
const char *old_target,
|
||||
const char *new_target,
|
||||
enum ref_transaction_error err,
|
||||
const char *details,
|
||||
void *cb_data UNUSED)
|
||||
{
|
||||
struct strbuf sb = STRBUF_INIT;
|
||||
|
||||
if (details && *details)
|
||||
error("%s", details);
|
||||
|
||||
strbuf_addf(&sb, "rejected %s %s %s %s\n", refname,
|
||||
new_oid ? oid_to_hex(new_oid) : new_target,
|
||||
old_oid ? oid_to_hex(old_oid) : old_target,
|
||||
ref_transaction_error_msg(err));
|
||||
|
||||
fwrite(sb.buf, sb.len, 1, stdout);
|
||||
strbuf_release(&sb);
|
||||
}
|
||||
|
||||
static void parse_cmd_commit(struct ref_transaction *transaction,
|
||||
const char *next, const char *end UNUSED)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user