From 3ee9579c9fcca95a50422184b3cb3e4aaedbee0e Mon Sep 17 00:00:00 2001 From: Paul Young <84700+paulyoung@users.noreply.github.com> Date: Tue, 7 Feb 2023 16:50:57 -0800 Subject: [PATCH 1/8] Remove old comment about side-band --- crates/git-remote-helper/src/commands/push.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/crates/git-remote-helper/src/commands/push.rs b/crates/git-remote-helper/src/commands/push.rs index 0b78746..b3790f4 100644 --- a/crates/git-remote-helper/src/commands/push.rs +++ b/crates/git-remote-helper/src/commands/push.rs @@ -189,15 +189,11 @@ where .collect::>(), ); - // NOTE + // NOTE: We send `report-status-v2` so that we receive a response + // that includes a status report. // - // * We send `report-status-v2` so that we receive a - // response that includes a status report. We parse this - // and write a status report to stdout in the format that - // remote helpers are expected to produce. - // - // * See comments on reading the `receive-pack` response as - // to why we send the sideband capability. + // We parse this and write a status report to stdout in the format + // that remote helpers are expected to produce. let chunk = format!( "{} {} {}\0 report-status-v2", dst_id.to_hex(), From bcac6d241924f2b11b3fec42f784866d148af33f Mon Sep 17 00:00:00 2001 From: Paul Young <84700+paulyoung@users.noreply.github.com> Date: Tue, 7 Feb 2023 16:57:20 -0800 Subject: [PATCH 2/8] Capability list should have a trailing space https://git-scm.com/docs/http-protocol/2.16.6#_smart_service_git_receive_pack --- crates/git-remote-helper/src/commands/push.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/git-remote-helper/src/commands/push.rs b/crates/git-remote-helper/src/commands/push.rs index b3790f4..7219304 100644 --- a/crates/git-remote-helper/src/commands/push.rs +++ b/crates/git-remote-helper/src/commands/push.rs @@ -195,7 +195,7 @@ where // We parse this and write a status report to stdout in the format // that remote helpers are expected to produce. let chunk = format!( - "{} {} {}\0 report-status-v2", + "{} {} {}\0 report-status-v2 ", dst_id.to_hex(), src_id.to_hex(), dst From 7218b48104e12afc57b9de8d19fc37728a542fce Mon Sep 17 00:00:00 2001 From: Paul Young <84700+paulyoung@users.noreply.github.com> Date: Tue, 7 Feb 2023 16:58:50 -0800 Subject: [PATCH 3/8] Command list should end with a line feed https://git-scm.com/docs/http-protocol/2.16.6#_smart_service_git_receive_pack --- crates/git-remote-helper/src/commands/push.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/git-remote-helper/src/commands/push.rs b/crates/git-remote-helper/src/commands/push.rs index 7219304..38090a0 100644 --- a/crates/git-remote-helper/src/commands/push.rs +++ b/crates/git-remote-helper/src/commands/push.rs @@ -195,7 +195,7 @@ where // We parse this and write a status report to stdout in the format // that remote helpers are expected to produce. let chunk = format!( - "{} {} {}\0 report-status-v2 ", + "{} {} {}\0 report-status-v2 \n", dst_id.to_hex(), src_id.to_hex(), dst From b4ba564e2596545a6eeec7f73b7957d40daa354a Mon Sep 17 00:00:00 2001 From: Paul Young <84700+paulyoung@users.noreply.github.com> Date: Tue, 7 Feb 2023 17:02:20 -0800 Subject: [PATCH 4/8] Request both report-status and report-status-v2 --- crates/git-remote-helper/src/commands/push.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/git-remote-helper/src/commands/push.rs b/crates/git-remote-helper/src/commands/push.rs index 38090a0..64d010a 100644 --- a/crates/git-remote-helper/src/commands/push.rs +++ b/crates/git-remote-helper/src/commands/push.rs @@ -189,13 +189,13 @@ where .collect::>(), ); - // NOTE: We send `report-status-v2` so that we receive a response - // that includes a status report. + // NOTE: We request `report-status` and `report-status-v2` so that + // we receive a response that includes a status report. // // We parse this and write a status report to stdout in the format // that remote helpers are expected to produce. let chunk = format!( - "{} {} {}\0 report-status-v2 \n", + "{} {} {}\0 report-status report-status-v2 \n", dst_id.to_hex(), src_id.to_hex(), dst From d198d66ec81f02021ba71661e261f2d4b744b325 Mon Sep 17 00:00:00 2001 From: Paul Young <84700+paulyoung@users.noreply.github.com> Date: Tue, 7 Feb 2023 17:05:02 -0800 Subject: [PATCH 5/8] Update comment about status report --- crates/git-remote-helper/src/commands/push.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/git-remote-helper/src/commands/push.rs b/crates/git-remote-helper/src/commands/push.rs index 64d010a..e6287e5 100644 --- a/crates/git-remote-helper/src/commands/push.rs +++ b/crates/git-remote-helper/src/commands/push.rs @@ -192,8 +192,12 @@ where // NOTE: We request `report-status` and `report-status-v2` so that // we receive a response that includes a status report. // - // We parse this and write a status report to stdout in the format - // that remote helpers are expected to produce. + // We request both in case a server only advertises one or the + // other. + // + // We parse the status report from the response and write our own + // status report to stdout in the format that remote helpers are + // expected to produce. let chunk = format!( "{} {} {}\0 report-status report-status-v2 \n", dst_id.to_hex(), From 54995ceb6ff2d17b01699caf0d6696b9dceec608 Mon Sep 17 00:00:00 2001 From: Paul Young <84700+paulyoung@users.noreply.github.com> Date: Wed, 8 Feb 2023 14:54:47 -0800 Subject: [PATCH 6/8] Add TODO for object-format and agent cabapilities --- crates/git-remote-helper/src/commands/push.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/git-remote-helper/src/commands/push.rs b/crates/git-remote-helper/src/commands/push.rs index e6287e5..3faa732 100644 --- a/crates/git-remote-helper/src/commands/push.rs +++ b/crates/git-remote-helper/src/commands/push.rs @@ -199,6 +199,7 @@ where // status report to stdout in the format that remote helpers are // expected to produce. let chunk = format!( + // TODO: object-format=sha1 and agent= "{} {} {}\0 report-status report-status-v2 \n", dst_id.to_hex(), src_id.to_hex(), From 3b676450c6281537fb1ff31a399fd369455d7ac4 Mon Sep 17 00:00:00 2001 From: Paul Young <84700+paulyoung@users.noreply.github.com> Date: Wed, 22 Feb 2023 16:56:31 -0800 Subject: [PATCH 7/8] Use the format described in more comprehensive doc --- crates/git-remote-helper/src/commands/push.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/git-remote-helper/src/commands/push.rs b/crates/git-remote-helper/src/commands/push.rs index 3faa732..dcaae36 100644 --- a/crates/git-remote-helper/src/commands/push.rs +++ b/crates/git-remote-helper/src/commands/push.rs @@ -1,3 +1,5 @@ +// https://git-scm.com/docs/pack-protocol#_reference_update_request_and_packfile_transfer + use crate::git::service::receive_pack; use anyhow::anyhow; use git::bstr::ByteSlice as _; @@ -200,7 +202,7 @@ where // expected to produce. let chunk = format!( // TODO: object-format=sha1 and agent= - "{} {} {}\0 report-status report-status-v2 \n", + "{} {} {}\0report-status report-status-v2\n", dst_id.to_hex(), src_id.to_hex(), dst From 12fa611cad3b62c05008796f1a17eee8fb854063 Mon Sep 17 00:00:00 2001 From: Paul Young <84700+paulyoung@users.noreply.github.com> Date: Wed, 22 Feb 2023 16:59:14 -0800 Subject: [PATCH 8/8] Add FIXME --- crates/git-remote-helper/src/commands/push.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/git-remote-helper/src/commands/push.rs b/crates/git-remote-helper/src/commands/push.rs index dcaae36..ff2970a 100644 --- a/crates/git-remote-helper/src/commands/push.rs +++ b/crates/git-remote-helper/src/commands/push.rs @@ -200,6 +200,9 @@ where // We parse the status report from the response and write our own // status report to stdout in the format that remote helpers are // expected to produce. + // + // FIXME: we only want to include the capability list on the first + // line. let chunk = format!( // TODO: object-format=sha1 and agent= "{} {} {}\0report-status report-status-v2\n",