threads / discuss / 12817

List all SHA1 hashes in repo

Subject: List all SHA1 hashes in repo

## tl;dr

8 messages between Mar 23, 2008 and Mar 23, 2008.

replies: 7people: 5as markdown or json

Alexander Gladysh· Mar 23, 2008, 13:17 UTC · lore
Hi, list!

To help testing little Git-related tool I'm writing, I need a lot of pregenerated SHA1 hashes. Git repo seems to be a perfect source of such. Is there an easy way to extract a list of all (well, most of) SHA1 hashes in the repo?

The git rev-list --all gives nice list, but, as I understand, that is only commit objects, and there are much more of SHA1 hidden inside.

Thanks in advance, Alexander.

Peter Harris· Mar 23, 2008, 13:40 UTC · re: Alexander Gladysh · lore

Re: List all SHA1 hashes in repo

On Sun, Mar 23, 2008 at 9:17 AM, Alexander Gladysh <agladysh@gmail.com> wrote:
>  To help testing little Git-related tool I'm writing, I need a lot of
>  pregenerated SHA1 hashes. Git repo seems to be a perfect source of
>  such. Is there an easy way to extract a list of all (well, most of)
>  SHA1 hashes in the repo?

After a "git gc" to roll everything into a single pack, you could do a "git verify-pack -v" to list all the SHA1s in the pack.

Peter Harris
Johannes Schindelin· Mar 23, 2008, 13:59 UTC · re: Alexander Gladysh · lore

Re: List all SHA1 hashes in repo

Hi,
On Sun, 23 Mar 2008, Alexander Gladysh wrote:
Show 7 quoted lines
> To help testing little Git-related tool I'm writing, I need a lot of
> pregenerated SHA1 hashes. Git repo seems to be a perfect source of
> such. Is there an easy way to extract a list of all (well, most of)
> SHA1 hashes in the repo?
> 
> The git rev-list --all gives nice list, but, as I understand, that is
> only commit objects, and there are much more of SHA1 hidden inside.
Just add --objects.

Ciao, Dscho

Pieter de Bie· Mar 23, 2008, 14:21 UTC · re: Johannes Schindelin · lore

Re: List all SHA1 hashes in repo

On Mar 23, 2008, at 2:59 PM, Johannes Schindelin wrote:
>> The git rev-list --all gives nice list, but, as I understand, that is
>> only commit objects, and there are much more of SHA1 hidden inside.
>
> Just add --objects.
I thought --all --objects only shows reachable objects?
- Pieter
(Dscho, sorry for the double post)
Johannes Schindelin· Mar 23, 2008, 14:33 UTC · lore

Re: List all SHA1 hashes in repo

Hi,
On Sun, 23 Mar 2008, Pieter de Bie wrote:
Show 8 quoted lines
> On Mar 23, 2008, at 2:59 PM, Johannes Schindelin wrote:
> > > The git rev-list --all gives nice list, but, as I understand, that 
> > > is only commit objects, and there are much more of SHA1 hidden 
> > > inside.
> >
> > Just add --objects.
> 
> I thought --all --objects only shows reachable objects?
Ah yes.  But usually the objects in packs are reachable...

So you're right, it does not really show _all_ objects. But it shows many objects, and is pretty easy (which I think was the original poster's real question).

Ciao, Dscho

P.S.: I got two mails from you, one without the Cc: list, and one with it... Strange.

Alexander Gladysh· Mar 23, 2008, 15:44 UTC · re: Johannes Schindelin · lore

Re: List all SHA1 hashes in repo

Show 13 quoted lines
> > > > The git rev-list --all gives nice list, but, as I understand, that
>  > > > is only commit objects, and there are much more of SHA1 hidden
>  > > > inside.
>  > >
>  > > Just add --objects.
>
> > I thought --all --objects only shows reachable objects?
>
>  Ah yes.  But usually the objects in packs are reachable...
>
>  So you're right, it does not really show _all_ objects.  But it shows many
>  objects, and is pretty easy (which I think was the original poster's real
>  question).
Yes, this is a perfect solution. Thank you!
Alexander.
P.S. Sorry for double-posting, Dscho, I forgot Reply to All too. :-)
Junio C Hamano· Mar 23, 2008, 18:23 UTC · re: Johannes Schindelin · lore

Re: List all SHA1 hashes in repo

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 16 quoted lines
> Hi,
>
> On Sun, 23 Mar 2008, Pieter de Bie wrote:
>
>> On Mar 23, 2008, at 2:59 PM, Johannes Schindelin wrote:
>> > > The git rev-list --all gives nice list, but, as I understand, that 
>> > > is only commit objects, and there are much more of SHA1 hidden 
>> > > inside.
>> >
>> > Just add --objects.
>> 
>> I thought --all --objects only shows reachable objects?
>
> Ah yes.  But usually the objects in packs are reachable...
>
> So you're right, it does not really show _all_ objects.
"rev-list --objects --all"?
Johannes Schindelin· Mar 23, 2008, 18:48 UTC · re: Junio C Hamano · lore

Re: List all SHA1 hashes in repo

Hi,
On Sun, 23 Mar 2008, Junio C Hamano wrote:
Show 18 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > On Sun, 23 Mar 2008, Pieter de Bie wrote:
> >
> >> On Mar 23, 2008, at 2:59 PM, Johannes Schindelin wrote:
> >> > > The git rev-list --all gives nice list, but, as I understand, 
> >> > > that is only commit objects, and there are much more of SHA1 
> >> > > hidden inside.
> >> >
> >> > Just add --objects.
> >> 
> >> I thought --all --objects only shows reachable objects?
> >
> > Ah yes.  But usually the objects in packs are reachable...
> >
> > So you're right, it does not really show _all_ objects.
> 
> "rev-list --objects --all"?

I think Pieter's point was that there can be unreachable objects, an this command line does not show them.

Ciao, Dscho

← back to recent threads