Thảo M. Hoàng
Thảo M. Hoàng

Reputation: 1424

Where is source tree after git unpack-objects?

I have a GIT source objects.

$ tree .git
.git
├── branches
├── config
├── description
├── HEAD
├── hooks
│   ├── applypatch-msg.sample
│   ├── commit-msg.sample
│   ├── post-update.sample
│   ├── pre-applypatch.sample
│   ├── pre-commit.sample
│   ├── prepare-commit-msg.sample
│   ├── pre-rebase.sample
│   └── update.sample
├── info
│   └── exclude
├── objects
│   ├── info
│   │   └── packs
│   └── pack
│       ├── pack-8c58c09efcd6b2feb30685aca8e67801837860d3.idx
│       └── pack-8c58c09efcd6b2feb30685aca8e67801837860d3.pack
├── packed-refs
└── refs
    ├── heads
    └── tags

After unpack the object file.

$ git unpack-objects < .git/objects/pack/pack-8c58c09efcd6b2feb30685aca8e67801837860d3.pack

Unpacking objects: 100% (16748/16748), done.

The progress was done, but I cannot see the work tree of the source code.

Where will the source tree locate after unpacking objects ?

Upvotes: 0

Views: 783

Answers (2)

Thảo M. Ho&#224;ng
Thảo M. Ho&#224;ng

Reputation: 1424

Very simple in this case. Just enter the clone command.

   $ git clone .git my_source_tree
     Cloning into 'my_source_tree'...
     done.

Upvotes: 0

J&#246;rg W Mittag
J&#246;rg W Mittag

Reputation: 369584

unpack-objects does not create a source tree. It unpacks the object database from the packfile format into the loose objects format.

The loose objects will now be in .git/objects/<first two nibbles of SHA-1 object ID in hexadecimal representation>/<remainder of SHA-1 object ID in hexadecimal representation>

It is not quite clear what you want to achieve here. The storage format is completely transparent, all commands work with either the packed or the loose format (or a mixture of both). You never need to explicitly pack or unpack objects. You may sometimes want to explicitly pack the object database, because the packfile format is more storage-efficient. The other direction makes almost no sense.

Upvotes: 2

Related Questions