git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: unpack a single object

From
Ttarmigan <tarmigan+lists@gmail.com>
Date
Aug 12, 2009, 05:34 UTC
Message-ID
<905315640908112234y18463675ja35a5b5798793052@mail.gmail.com>
In-Reply-To
<3e8340490908111349j323812dbmf2211e4cf454b8f1@mail.gmail.com>
On Tue, Aug 11, 2009 at 1:49 PM, Bryan Donlan<bdonlan@gmail.com> wrote:
Show 23 quoted lines
> On Tue, Aug 11, 2009 at 4:48 PM, Bryan Donlan<bdonlan@gmail.com> wrote:
>> On Tue, Aug 11, 2009 at 4:15 PM, tarmigan<tarmigan+lists@gmail.com> wrote:
>>> I would rather not copy the whole good repo back to the one that ran
>>> out of space because it's multiple gigs.  My plan is to just explode
>>> the bad pack on of the corrupted repo, explode good pack and then,
>>> copy the corrupted object back.  So my question is how do I tell which
>>> pack contains that object?  (I would rather not explode all the packs
>>> because of the repo size.)  Is there a way to extract a single object
>>> from a pack without exploding the whole pack?
>>
>> You should be able to just extract the single object in question:
>>
>> goodrepo$ git cat-file commit 3d4c2b0225e7605a7e2a38ffc44dcb888589f4ce
>>  > ~/commit.dat
>> goodrepo$ cd ~/badrepo
>> badrepo$ git read-file -t commit ~/commit.dat
>> (should output 3d4c2b0225e7605a7e2a38ffc44dcb888589f4ce)
>>
>> At this point your repo should be repaired.
>>
>
> Err, that should read git hash-object, not git read-file.
>

Thanks, and thanks to Junio who also responded with something similar off-list. I was vaguely familiar with cat-file and hash-object before but didn't realize how they could be used to do what I wanted, so thanks for the lesson.

As Junio suspected, I after the next fsck, I also had problems with the tree associated with that commit and also the commits behind that one. Each fsck takes around 12 minutes, so replacing one commit at a time seemed not very productive. So now I am doing another svn clone from scratch and letting it run for a few hours (it was a straight mirror, so nothing is lost). It seems somewhat wasteful, but I guess better a few hours of cpu time than a few hours of my time.

Thanks, Tarmigan

Previous: Bryan Donlan
Message 4 of 4 in “unpack a single object”
  1. tarmiganAug 11, 2009
  2. Bryan DonlanAug 11, 2009
  3. Bryan DonlanAug 11, 2009
  4. tarmiganAug 12, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.