Git development
 help / color / mirror / Atom feed
From: "Philip Oakley" <philipoakley@iee.org>
To: "??" <xudifsd@gmail.com>
Cc: "Git List" <git@vger.kernel.org>
Subject: Re: Manually decoding a git object
Date: Mon, 20 Feb 2012 08:19:44 -0000	[thread overview]
Message-ID: <B268B28A80B446BBADED9B3B6BA4B205@PhilipOakley> (raw)
In-Reply-To: CAMocUqRNNXpGOJ2ZG8bWpkieKkVfoo0=Lkevjw+E3Tssw68Hwg@mail.gmail.com

From: "??" <xudifsd@gmail.com> Sent: Monday, February 20, 2012 4:45 AM
> 2012/2/20 Philip Oakley <philipoakley@iee.org>:
>> If I have a renamed file which is a git object, such a "Git_Object", was
>> 8c-something-or-other, what is the easiest way of examining / decoding /
>> recreating the original file (either as its sha1, or a cat-file).
>>
> I don't think I fully understood what you mean, I assume you just move
> an object file from $GIT_DIR/objects/ to somewhere and rename it,
> let's call it "obj", so if you want to exam its content you can just
> simply call "git cat-file -p obj". And you can also use "git cat-file
> -t obj" to exam its object type. If it's a blob you can use "git
> cat-file -p obj > original" to recreate it, else it's meaningless to
> recreate it.

When I tried it from my home directory (not in a git directory):
$ git cat-file -p Git-Object
fatal: Not a git repository (or any of the parent directories): .git

Because its sha1 isn't yet known I can't put it into the correct 
.git/objects/xx/ subdirectory of an fresh 'git init', and I have located an 
unzip programme that will take the plain git object and decode it - they all 
expect archives.

I've described the background use-case at 
http://stackoverflow.com/questions/9341278/how-to-track-the-git-directory-in-git-in-its-own-store - 
the edit links to a typical corporate scenario.

Even just locating a zlib implementation that simply confirms the file 
stream is compressesd and deflates it would be a start.
Philip

  reply	other threads:[~2012-02-20  8:19 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-15 13:22 [PATCH/RFC] Document format of basic Git objects Nguyễn Thái Ngọc Duy
2012-02-15 17:31 ` Jonathan Nieder
2012-02-15 19:48 ` Junio C Hamano
2012-02-16  7:12   ` Junio C Hamano
2012-02-19  4:15 ` [PATCH/RFC v2] " Nguyễn Thái Ngọc Duy
2012-02-19  8:39   ` Junio C Hamano
2012-02-19  9:14     ` Junio C Hamano
2012-02-20 13:55     ` Nguyen Thai Ngoc Duy
2012-02-20 16:11       ` Jeff King
2012-02-19 18:07   ` Manually decoding a git object Philip Oakley
2012-02-20  4:45     ` 徐迪
2012-02-20  8:19       ` Philip Oakley [this message]
2012-02-20  8:29     ` Thomas Rast
2012-02-20 10:19       ` Philip Oakley
2012-02-20 10:56         ` Thomas Rast
2012-02-20 11:39           ` 徐迪
2012-02-20 18:27           ` Philip Oakley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B268B28A80B446BBADED9B3B6BA4B205@PhilipOakley \
    --to=philipoakley@iee.org \
    --cc=git@vger.kernel.org \
    --cc=xudifsd@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox