threads / discuss / 53699

filtering on git fetch?

Subject: filtering on git fetch?

## tl;dr

4 messages between Jun 17, 2020 and Jun 17, 2020.

replies: 3people: 2as markdown or json

Noel Grandin· Jun 17, 2020, 07:41 UTC · lore
Hi
Setup

(*) I'm fetching across a transatlantic link (RTT in the 300ms range on a good day) (*) I'm fetching from a gerrit server

$ GIT_PACKET_TRACE=true git fetch
shows tons and tons of

09:39:43.355675 pkt-line.c:80 packet: fetch< 3a7ad7ee5d7daa0c93a80fbb32a677597d81ac75 refs/changes/00/9000/3 09:39:43.355684 pkt-line.c:80 packet: fetch< 6cacf1db5311f6b250ebaa12c71419a8ff9b747e refs/changes/00/9000/meta 09:39:43.355693 pkt-line.c:80 packet: fetch< 849a43434a5ede9ce9b70da14231f34edb2593fb refs/changes/00/90100/1

type stuff before it starts fetching the updates to master that I am interested in.
Is there any way to tell the remote git server that I'm only interested in a subset of stuff?
Thanks, Noel Grandin
Jeff King· Jun 17, 2020, 08:34 UTC · re: Noel Grandin · lore

Re: filtering on git fetch?

On Wed, Jun 17, 2020 at 09:41:37AM +0200, Noel Grandin wrote:
Show 19 quoted lines
> Setup
> 
> (*) I'm fetching across a transatlantic link (RTT in the 300ms range on a good day)
> (*) I'm fetching from a gerrit server
> 
> $ GIT_PACKET_TRACE=true git fetch
> 
> shows tons and tons of
> 
> 09:39:43.355675 pkt-line.c:80           packet:        fetch<
> 3a7ad7ee5d7daa0c93a80fbb32a677597d81ac75 refs/changes/00/9000/3
> 09:39:43.355684 pkt-line.c:80           packet:        fetch<
> 6cacf1db5311f6b250ebaa12c71419a8ff9b747e refs/changes/00/9000/meta
> 09:39:43.355693 pkt-line.c:80           packet:        fetch<
> 849a43434a5ede9ce9b70da14231f34edb2593fb refs/changes/00/90100/1
> 
> type stuff before it starts fetching the updates to master that I am interested in.
> 
> Is there any way to tell the remote git server that I'm only interested in a subset of stuff?

The ref advertisement in the v0 protocol is unconditional and always complete. In v2, the client is able to specify which parts of the namespace it cares about.

Try:
  GIT_TRACE_PACKET=1 git -c protocol.version=2

This will probably be the default in v2.28 (it was the default in v2.26, but there was a performance regression, so we backed it out for v2.27).

-Peff
Noel Grandin· Jun 17, 2020, 08:42 UTC · re: Jeff King · lore

Re: filtering on git fetch?

On 2020/06/17 10:34 am, Jeff King wrote:
> 
> The ref advertisement in the v0 protocol is unconditional and always
> complete. In v2, the client is able to specify which parts of the
> namespace it cares about.
Thanks
I tried (BTW my version is 2.26.2)
$ GIT_TRACE_PACKET=1 git -c protocol.version=2 pull -r
and the first few lines look like

10:35:59.323490 pkt-line.c:80 packet: fetch< ad0351b84926075297fb74abbe9b31a0455782af HEAD\0 include-tag multi_ack_detailed multi_ack o fs-delta side-band side-band-64k thin-pack no-progress shallow agent=JGit/5.3.7.202002110540-r symref=HEAD:refs/heads/master 10:35:59.323583 pkt-line.c:80 packet: fetch< baeb5486c43d39b063371f91cfaae8efc2c8700b refs/changes/00/1000/1 10:35:59.323592 pkt-line.c:80 packet: fetch< c5fb3d3f110f652e3c4b3920f71b7f77c227028e refs/changes/00/1000/meta 10:35:59.323597 pkt-line.c:80 packet: fetch< dfbfb3c4d4cc7d7f519c197ef5cfa250c30b584b refs/changes/00/10000/1 10:35:59.323602 pkt-line.c:80 packet: fetch< 5955e7d66d9b0e87f93fd9746a85bff132da9794 refs/changes/00/10000/2 10:35:59.323608 pkt-line.c:80 packet: fetch< ae3baacef7926d9ce9ca4786176f404b7cf78cc1 refs/changes/00/10000/meta

Is there something else I need to do on the client-side to make this work?

Noting that the git server at gerrit.libreoffice.org might be a JGit based thing, so maybe I need to log a feature request there to support v2?

Jeff King· Jun 17, 2020, 11:32 UTC · re: Noel Grandin · lore

Re: filtering on git fetch?

On Wed, Jun 17, 2020 at 10:42:24AM +0200, Noel Grandin wrote:
> I tried (BTW my version is 2.26.2)
> 
> $ GIT_TRACE_PACKET=1 git -c protocol.version=2 pull -r
Ah, yeah, I think it should be the default in that version anyway.
Show 6 quoted lines
> and the first few lines look like
> 
> 10:35:59.323490 pkt-line.c:80           packet:        fetch<
> ad0351b84926075297fb74abbe9b31a0455782af HEAD\0 include-tag
> multi_ack_detailed multi_ack o
> fs-delta side-band side-band-64k thin-pack no-progress shallow agent=JGit/5.3.7.202002110540-r symref=HEAD:refs/heads/master
Yep, that's definitely v0.
> Is there something else I need to do on the client-side to make this work?

No, probably the server doesn't support v2. I double-checked myself, and couldn't get it to speak v2 either.

> Noting that the git server at gerrit.libreoffice.org might be a JGit based
> thing, so maybe I need to log a feature request there to support v2?

Probably. I'm fairly certain that JGit has supported v2 for a while. Just poking at `git log` in jgit.git shows some commits adding it around the 5.0 timeframe. So I'd think the version they're advertising would have it. I don't know offhand if there's a config option they'd need to flip on the server.

-Peff

← back to recent threads