Re: Low-level repository inspection (Re: Where do I stick development documentation?)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 12, 2010 at 03:17, Jonathan Nieder <jrnieder@xxxxxxxxx> 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@xxxxxxxxx> 1281551520 -0700
    committer Junio C Hamano <gitster@xxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]