# git-unpack-objects

9 messages from 2006-05-01 to 2006-05-04. Participants: Josh Boyer, Junio C Hamano, Linus Torvalds, Marco Roeland.
Thread: https://gitlist.dev/t/4019

## Josh Boyer, 2006-05-01 22:52

Subject: git-unpack-objects
Message-ID: <625fc13d0605011552j4189338bx14083657acffc18e@mail.gmail.com>
URL: https://gitlist.dev/e/625fc13d0605011552j4189338bx14083657acffc18e%40mail.gmail.com

```
I was playing around with git repack and decided to "undo" the repack
I did using git-unpack objects.  Below is the output:

[jwboyer@vader linux-2.6]$ git-unpack-objects <
.git/objects/pack/pack-497d1e639572013de48eeb00cb95738d2ca959e1.pack
Unpacking 236950 objects
 100% (236950/236950) done
[jwboyer@vader linux-2.6]$ ls -l .git/objects/
total 8
drwxrwxr-x 2 jwboyer jwboyer 4096 May  1 17:48 info
drwxrwxr-x 2 jwboyer jwboyer 4096 May  1 17:48 pack
[jwboyer@vader linux-2.6]$


As you can see, the objects don't seem to get unpacked back into the
.git directory.  So either I am misunderstanding what that command is
supposed to do, or it isn't working properly.

Any ideas?

thx,
josh

```

## Junio C Hamano, 2006-05-01 23:09

Subject: Re: git-unpack-objects
Message-ID: <7vu089qr4t.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vu089qr4t.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <625fc13d0605011552j4189338bx14083657acffc18e@mail.gmail.com>

```
"Josh Boyer" <jwboyer@gmail.com> writes:

> I was playing around with git repack and decided to "undo" the repack
> I did using git-unpack objects.  Below is the output:
>
> [jwboyer@vader linux-2.6]$ git-unpack-objects <
> .git/objects/pack/pack-497d1e639572013de48eeb00cb95738d2ca959e1.pack
> Unpacking 236950 objects
> 100% (236950/236950) done
> [jwboyer@vader linux-2.6]$ ls -l .git/objects/
> total 8
> drwxrwxr-x 2 jwboyer jwboyer 4096 May  1 17:48 info
> drwxrwxr-x 2 jwboyer jwboyer 4096 May  1 17:48 pack
> [jwboyer@vader linux-2.6]$
>
> As you can see, the objects don't seem to get unpacked back into the
> .git directory.  So either I am misunderstanding what that command is
> supposed to do, or it isn't working properly.
>
> Any ideas?

unpack tries to unpack and if it already has the object it
skips.

If you really wanted to do it, here is a way to do so.

	mv .git/objets/pack/pack-49*.pack \
		.git/objets/pack/pack-49*.idx .
	git unpack-objects <pack-49*.pack

```

## Josh Boyer, 2006-05-03 17:35

Subject: Re: git-unpack-objects
Message-ID: <625fc13d0605031035l721ab08dmee6f870abb49f4e4@mail.gmail.com>
URL: https://gitlist.dev/e/625fc13d0605031035l721ab08dmee6f870abb49f4e4%40mail.gmail.com
In-Reply-To: <7vu089qr4t.fsf@assigned-by-dhcp.cox.net>

```
On 5/1/06, Junio C Hamano <junkio@cox.net> wrote:
>
> unpack tries to unpack and if it already has the object it
> skips.
>
> If you really wanted to do it, here is a way to do so.
>
>         mv .git/objets/pack/pack-49*.pack \
>                 .git/objets/pack/pack-49*.idx .
>         git unpack-objects <pack-49*.pack

Hm..  so it seems that git-unpack-objects is more intended to unpack a
pack one has gotten with git-fetch-pack, right?

I was looking for something more along the lines of an
"un-git-repack", where you have existing pack(s) and want to undo
them.  Maybe you want to repack everything into a single pack or
something like that.

josh

```

## Linus Torvalds, 2006-05-03 17:41

Subject: Re: git-unpack-objects
Message-ID: <Pine.LNX.4.64.0605031041150.4086@g5.osdl.org>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0605031041150.4086%40g5.osdl.org
In-Reply-To: <625fc13d0605031035l721ab08dmee6f870abb49f4e4@mail.gmail.com>

```


On Wed, 3 May 2006, Josh Boyer wrote:
> 
> Hm..  so it seems that git-unpack-objects is more intended to unpack a
> pack one has gotten with git-fetch-pack, right?

Yeah. And for testing. I don't think it ever gets used directly.

> I was looking for something more along the lines of an
> "un-git-repack", where you have existing pack(s) and want to undo
> them.  Maybe you want to repack everything into a single pack or
> something like that.

That's what you just do "git repack -a -d" for.

		Linus

```

## Josh Boyer, 2006-05-03 17:44

Subject: Re: git-unpack-objects
Message-ID: <625fc13d0605031044y2ff03ed2h261db5455b234254@mail.gmail.com>
URL: https://gitlist.dev/e/625fc13d0605031044y2ff03ed2h261db5455b234254%40mail.gmail.com
In-Reply-To: <Pine.LNX.4.64.0605031041150.4086@g5.osdl.org>

```
On 5/3/06, Linus Torvalds <torvalds@osdl.org> wrote:
>
>
> On Wed, 3 May 2006, Josh Boyer wrote:
> >
> > Hm..  so it seems that git-unpack-objects is more intended to unpack a
> > pack one has gotten with git-fetch-pack, right?
>
> Yeah. And for testing. I don't think it ever gets used directly.
>
> > I was looking for something more along the lines of an
> > "un-git-repack", where you have existing pack(s) and want to undo
> > them.  Maybe you want to repack everything into a single pack or
> > something like that.
>
> That's what you just do "git repack -a -d" for.

But that doesn't roll exsisting packs into a new pack, does it?  I
thought it just packed loose objects into a new pack and deleted them.
 I ran that on a repo that already had a couple packs in it, and the
old packs were still there.

josh

```

## Linus Torvalds, 2006-05-03 17:56

Subject: Re: git-unpack-objects
Message-ID: <Pine.LNX.4.64.0605031054300.4086@g5.osdl.org>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0605031054300.4086%40g5.osdl.org
In-Reply-To: <625fc13d0605031044y2ff03ed2h261db5455b234254@mail.gmail.com>

```


On Wed, 3 May 2006, Josh Boyer wrote:
> > 
> > That's what you just do "git repack -a -d" for.
> 
> But that doesn't roll exsisting packs into a new pack, does it? 

It does. That's what the "-a" (for "all") does.

I don't personally do incremental packs at all - the full repack is fast 
enough on the hardware I use (especially since Junio just kicked it into 
some serious performance shape) that I don't have the need for 
incrementals. 

		Linus

```

## Josh Boyer, 2006-05-04 00:31

Subject: Re: git-unpack-objects
Message-ID: <625fc13d0605031731v7b65a738r6fc0169958235928@mail.gmail.com>
URL: https://gitlist.dev/e/625fc13d0605031731v7b65a738r6fc0169958235928%40mail.gmail.com
In-Reply-To: <Pine.LNX.4.64.0605031054300.4086@g5.osdl.org>

```
On 5/3/06, Linus Torvalds <torvalds@osdl.org> wrote:
>
>
> On Wed, 3 May 2006, Josh Boyer wrote:
> > >
> > > That's what you just do "git repack -a -d" for.
> >
> > But that doesn't roll exsisting packs into a new pack, does it?
>
> It does. That's what the "-a" (for "all") does.

Odd.  On one of my repos, I was seeing the correct behavior.  On
another, there were multiple packs left after doing the 'git repack -a
-d'.  Were there ever some packing bugs in older versions of git that
would have maybe produced some packs that wouldn't get deleted or
something?

At any rate, the above command does seem to do exactly what I want. 
Thanks for the help.

josh

```

## Marco Roeland, 2006-05-04 10:02

Subject: Re: git-unpack-objects
Message-ID: <20060504100237.GA10548@fiberbit.xs4all.nl>
URL: https://gitlist.dev/e/20060504100237.GA10548%40fiberbit.xs4all.nl
In-Reply-To: <625fc13d0605031731v7b65a738r6fc0169958235928@mail.gmail.com>

```
On Wednesday May 3rd 2006 Josh Boyer wrote:

> >It does. That's what the "-a" (for "all") does.
> 
> Odd.  On one of my repos, I was seeing the correct behavior.  On
> another, there were multiple packs left after doing the 'git repack -a
> -d'.  Were there ever some packing bugs in older versions of git that
> would have maybe produced some packs that wouldn't get deleted or
> something?

Have you checked with "git fsck-objects" that maybe the "remaining"
packs contained non-reachable objects like dangling commits from resets
or from following volatile branches like +pu?
-- 
Marco Roeland

```

## Josh Boyer, 2006-05-04 11:58

Subject: Re: git-unpack-objects
Message-ID: <625fc13d0605040458q1018c7ccl79e8effe23edf7d8@mail.gmail.com>
URL: https://gitlist.dev/e/625fc13d0605040458q1018c7ccl79e8effe23edf7d8%40mail.gmail.com
In-Reply-To: <20060504100237.GA10548@fiberbit.xs4all.nl>

```
On 5/4/06, Marco Roeland <marco.roeland@xs4all.nl> wrote:
> On Wednesday May 3rd 2006 Josh Boyer wrote:
>
> > >It does. That's what the "-a" (for "all") does.
> >
> > Odd.  On one of my repos, I was seeing the correct behavior.  On
> > another, there were multiple packs left after doing the 'git repack -a
> > -d'.  Were there ever some packing bugs in older versions of git that
> > would have maybe produced some packs that wouldn't get deleted or
> > something?
>
> Have you checked with "git fsck-objects" that maybe the "remaining"
> packs contained non-reachable objects like dangling commits from resets
> or from following volatile branches like +pu?

This was on a kernel repo, so no branches.  But dangling commits from
resets might have been present.  I can't tell now since I undid all
that packs and redid them into a single.  Thanks for the suggestion
though, that sounds like a perfectly reasonable explanation.

josh

```
