# capturing the packfile from git-upload-pack

6 messages from 2011-04-15 to 2011-04-16. Participants: madmarcos, Shawn Pearce, Junio C Hamano, Jeff King.
Thread: https://gitlist.dev/t/27102

## madmarcos, 2011-04-15 03:22

Subject: capturing the packfile from git-upload-pack
Message-ID: <1302837720729-6275146.post@n2.nabble.com>
URL: https://gitlist.dev/e/1302837720729-6275146.post%40n2.nabble.com

```
Hi folks,
is there a git command that can capture in a separate file the packfile that
is generated and transmitted from a "want"ed branch during the
git-upload-pack command? I need a good sample to study.
thanks!

--
View this message in context: http://git.661346.n2.nabble.com/capturing-the-packfile-from-git-upload-pack-tp6275146p6275146.html
Sent from the git mailing list archive at Nabble.com.

```

## Shawn Pearce, 2011-04-15 15:46

Subject: Re: capturing the packfile from git-upload-pack
Message-ID: <BANLkTimAt_gcp1uBR_0H7LJHUdFGqHbRvA@mail.gmail.com>
URL: https://gitlist.dev/e/BANLkTimAt_gcp1uBR_0H7LJHUdFGqHbRvA%40mail.gmail.com
In-Reply-To: <1302837720729-6275146.post@n2.nabble.com>

```
On Thu, Apr 14, 2011 at 23:22, madmarcos <fru574@my.utsa.edu> wrote:
> is there a git command that can capture in a separate file the packfile that
> is generated and transmitted from a "want"ed branch during the
> git-upload-pack command? I need a good sample to study.

No.

But you can create an input file yourself, the pkt-line format is
pretty simple. Pipe the input to git-upload-pack, and it will spit
back the response. :-)

-- 
Shawn.

```

## Junio C Hamano, 2011-04-15 17:46

Subject: Re: capturing the packfile from git-upload-pack
Message-ID: <7vy63bcsqz.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vy63bcsqz.fsf%40alter.siamese.dyndns.org
In-Reply-To: <BANLkTimAt_gcp1uBR_0H7LJHUdFGqHbRvA@mail.gmail.com>

```
Shawn Pearce <spearce@spearce.org> writes:

> On Thu, Apr 14, 2011 at 23:22, madmarcos <fru574@my.utsa.edu> wrote:
>> is there a git command that can capture in a separate file the packfile that
>> is generated and transmitted from a "want"ed branch during the
>> git-upload-pack command? I need a good sample to study.
>
> No.
>
> But you can create an input file yourself, the pkt-line format is
> pretty simple. Pipe the input to git-upload-pack, and it will spit
> back the response. :-)

If you are running 1.7.5-rc0 or newer, GIT_TRACE_PACKET may also be of
help.

```

## Jeff King, 2011-04-15 19:09

Subject: Re: capturing the packfile from git-upload-pack
Message-ID: <20110415190908.GA4093@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20110415190908.GA4093%40sigill.intra.peff.net
In-Reply-To: <7vy63bcsqz.fsf@alter.siamese.dyndns.org>

```
On Fri, Apr 15, 2011 at 10:46:28AM -0700, Junio C Hamano wrote:

> Shawn Pearce <spearce@spearce.org> writes:
> 
> > On Thu, Apr 14, 2011 at 23:22, madmarcos <fru574@my.utsa.edu> wrote:
> >> is there a git command that can capture in a separate file the packfile that
> >> is generated and transmitted from a "want"ed branch during the
> >> git-upload-pack command? I need a good sample to study.
> >
> > No.
> >
> > But you can create an input file yourself, the pkt-line format is
> > pretty simple. Pipe the input to git-upload-pack, and it will spit
> > back the response. :-)
> 
> If you are running 1.7.5-rc0 or newer, GIT_TRACE_PACKET may also be of
> help.

Sadly, no. I punted on outputting the actual pack since it is big and
binary, and I was only interested in the ref negotiation. My eventual
plan was that you could do:

  GIT_TRACE_PACKET=2 GIT_TRACE_PACKET_PACK=/tmp/foo.pack \
    git clone ...

and get the ref negotiation on stderr, and the pack dumped in a file.
However, there is one stumbling block: the packet tracing happens at a
very low level, and doesn't know if we are doing sideband-demuxing or
not. And it would need to know to that to put the proper data in the
packfile.

It may just be a matter of implementing the packfile tracing at a
slightly different layer (where we have already demuxed), but I haven't
looked closely at it.

-Peff

```

## Jeff King, 2011-04-15 19:25

Subject: Re: capturing the packfile from git-upload-pack
Message-ID: <20110415192519.GA5332@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20110415192519.GA5332%40sigill.intra.peff.net
In-Reply-To: <20110415190908.GA4093@sigill.intra.peff.net>

```
On Fri, Apr 15, 2011 at 03:09:08PM -0400, Jeff King wrote:

> On Fri, Apr 15, 2011 at 10:46:28AM -0700, Junio C Hamano wrote:
> 
> > Shawn Pearce <spearce@spearce.org> writes:
> > 
> > > On Thu, Apr 14, 2011 at 23:22, madmarcos <fru574@my.utsa.edu> wrote:
> > >> is there a git command that can capture in a separate file the packfile that
> > >> is generated and transmitted from a "want"ed branch during the
> > >> git-upload-pack command? I need a good sample to study.
> > >
> > > No.
> > >
> > > But you can create an input file yourself, the pkt-line format is
> > > pretty simple. Pipe the input to git-upload-pack, and it will spit
> > > back the response. :-)
> > 
> > If you are running 1.7.5-rc0 or newer, GIT_TRACE_PACKET may also be of
> > help.
> 
> Sadly, no. I punted on outputting the actual pack since it is big and
> binary, and I was only interested in the ref negotiation. My eventual
> plan was that you could do:
> 
>   GIT_TRACE_PACKET=2 GIT_TRACE_PACKET_PACK=/tmp/foo.pack \
>     git clone ...

Actually, thinking on it more, this is kind of stupid. The pack that we
fetch will end up in .git/objects/pack, so it's not that interesting to
dump (though I suppose in a fetch setting, you might want to actually
peek at the thin pack before it gets resolved).

More interesting is for the sender to dump the pack they send, which
would mean instrumenting pack-objects.

Or, as Shawn suggested, poking upload-pack yourself using a conversation
you read from GIT_TRACE_PACKET. Which is probably what you meant when
you suggested it in the first place. So I'll shut up now.

-Peff

```

## madmarcos, 2011-04-16 00:59

Subject: Re: capturing the packfile from git-upload-pack
Message-ID: <1302915559826-6278064.post@n2.nabble.com>
URL: https://gitlist.dev/e/1302915559826-6278064.post%40n2.nabble.com
In-Reply-To: <BANLkTimAt_gcp1uBR_0H7LJHUdFGqHbRvA@mail.gmail.com>

```
Thanks, Shawn. Worked like a charm. Sometimes I forget the awesomeness that
is Unix.

--
View this message in context: http://git.661346.n2.nabble.com/capturing-the-packfile-from-git-upload-pack-tp6275146p6278064.html
Sent from the git mailing list archive at Nabble.com.

```
