git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>,
	Thomas Rast <trast@student.ethz.ch>
Subject: Re: Low-level repository inspection (Re: Where do I stick development  documentation?)
Date: Thu, 12 Aug 2010 03:40:34 +0000	[thread overview]
Message-ID: <AANLkTikpT=PD0Q8d=6=989N6rxYXH-Le3Go_szAz-t4s@mail.gmail.com> (raw)
In-Reply-To: <20100812031756.GD19174@burratino>

On Thu, Aug 12, 2010 at 03:17, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Ævar Arnfjörð Bjarmason wrote:
>
>> It'd also be very neat if we had tools to print out any object in its
>> raw form, --pretty=raw is partly there, but it's more pretty than
>> raw.
>
> How about git cat-file (and other “interrogation commands” listed in
> git.1)?

Those are part of the way there, but you often have to tease info out
of them, e.g. if you want a commit -> commit roundtrip:

    $ echo 7980e417 | git cat-file --batch | perl -0777 -pe 's/.*
commit ([0-9]*).(.*)\n/commit $1\0$2/s'|sha1sum
    7980e41746bc5de91eea775f9142ce44b1100361  -

The raw output from that is:

    $ echo 7980e417 | git cat-file --batch
    7980e41746bc5de91eea775f9142ce44b1100361 commit 525
    tree 782007df51255ab3793e528a4b5c4a69342166f2
    parent 0d0ba03a18a9c6cbc3d55c1b6834b9c3824f823f
    parent b5e233ecc411c8685463333d180a135c6866c50e
    author Junio C Hamano <gitster@pobox.com> 1281551520 -0700
    committer Junio C Hamano <gitster@pobox.com> 1281551520 -0700

    Merge branch 'maint'

    * maint:
      post-receive-email: remove spurious commas in email subject
      fast-import: export correctly marks larger than 2^20-1
      t/lib-git-svn.sh: use $PERL_PATH for perl, not perl from $PATH
      diff: strip extra "/" when stripping prefix

It'd be nice to answer "how are object stored" with something like:

    $ echo 7980e417 | git some-thing --pretty=raw -
    commit <SP> 525 <NULL>
    tree ....

And be able to do something similar to see what's stored in an
arbitrary pack file, I've often wished I had something like that when
using git-fsck.

These docs are also an excellent resource, afaict we only hint at
something like this in git, e.g. in the git-cat-file(1) manpage:
http://www-cs-students.stanford.edu/~blynn/gitmagic/ch08.html

  reply	other threads:[~2010-08-12  3:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-11 22:49 Where do I stick development documentation? Ævar Arnfjörð Bjarmason
2010-08-12  2:39 ` Jonathan Nieder
2010-08-12  3:11   ` Ævar Arnfjörð Bjarmason
2010-08-12  3:17     ` Low-level repository inspection (Re: Where do I stick development documentation?) Jonathan Nieder
2010-08-12  3:40       ` Ævar Arnfjörð Bjarmason [this message]
2010-08-12  3:57         ` Jonathan Nieder
2010-08-12 20:00     ` Where do I stick development documentation? Michael Witten
2010-08-12 20:08       ` Ævar Arnfjörð Bjarmason
2010-08-12 20:29         ` Jonathan Nieder
2010-08-12 20:33     ` Jonathan Nieder
2010-08-12 20:37       ` Ævar Arnfjörð Bjarmason

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to='AANLkTikpT=PD0Q8d=6=989N6rxYXH-Le3Go_szAz-t4s@mail.gmail.com' \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=trast@student.ethz.ch \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).