Re: Low-level repository inspection (Re: Where do I stick development documentation?)
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Aug 12, 2010, 03:40 UTC
- Message-ID
- <AANLkTikpT=PD0Q8d=6=989N6rxYXH-Le3Go_szAz-t4s@mail.gmail.com>
- In-Reply-To
- <20100812031756.GD19174@burratino>
On Thu, Aug 12, 2010 at 03:17, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 8 quoted lines
> Æ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 -0700Merge 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 prefixIt'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