summaryrefslogtreecommitdiff
path: root/builtin/send-pack.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-09-25 22:25:39 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-09-25 22:25:39 (GMT)
commit6c430a647cb990fc856d328733fa59e1fafadb97 (patch)
tree09bf6873a1b13f2f0178d864a09a30f9fe3cf09a /builtin/send-pack.c
parent48794acc50f14394ca6c4f5092a4a498f409f350 (diff)
parentd6edc189f6b3d8606150a52fd2c2fcd781b8550f (diff)
downloadgit-6c430a647cb990fc856d328733fa59e1fafadb97.zip
git-6c430a647cb990fc856d328733fa59e1fafadb97.tar.gz
git-6c430a647cb990fc856d328733fa59e1fafadb97.tar.bz2
Merge branch 'jx/proc-receive-hook'
"git receive-pack" that accepts requests by "git push" learned to outsource most of the ref updates to the new "proc-receive" hook. * jx/proc-receive-hook: doc: add documentation for the proc-receive hook transport: parse report options for tracking refs t5411: test updates of remote-tracking branches receive-pack: new config receive.procReceiveRefs doc: add document for capability report-status-v2 New capability "report-status-v2" for git-push receive-pack: feed report options to post-receive receive-pack: add new proc-receive hook t5411: add basic test cases for proc-receive hook transport: not report a non-head push as a branch
Diffstat (limited to 'builtin/send-pack.c')
-rw-r--r--builtin/send-pack.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/builtin/send-pack.c b/builtin/send-pack.c
index 2b9610f..7af148d 100644
--- a/builtin/send-pack.c
+++ b/builtin/send-pack.c
@@ -29,10 +29,12 @@ static struct send_pack_args args;
static void print_helper_status(struct ref *ref)
{
struct strbuf buf = STRBUF_INIT;
+ struct ref_push_report *report;
for (; ref; ref = ref->next) {
const char *msg = NULL;
const char *res;
+ int count = 0;
switch(ref->status) {
case REF_STATUS_NONE:
@@ -94,6 +96,23 @@ static void print_helper_status(struct ref *ref)
}
strbuf_addch(&buf, '\n');
+ if (ref->status == REF_STATUS_OK) {
+ for (report = ref->report; report; report = report->next) {
+ if (count++ > 0)
+ strbuf_addf(&buf, "ok %s\n", ref->name);
+ if (report->ref_name)
+ strbuf_addf(&buf, "option refname %s\n",
+ report->ref_name);
+ if (report->old_oid)
+ strbuf_addf(&buf, "option old-oid %s\n",
+ oid_to_hex(report->old_oid));
+ if (report->new_oid)
+ strbuf_addf(&buf, "option new-oid %s\n",
+ oid_to_hex(report->new_oid));
+ if (report->forced_update)
+ strbuf_addstr(&buf, "option forced-update\n");
+ }
+ }
write_or_die(1, buf.buf, buf.len);
}
strbuf_release(&buf);