# [BUG] --pretty=format does not work ok with rev-list

3 messages from 2008-04-12 to 2008-04-25. Participants: k0001, Jörg Sommer, Junio C Hamano.
Thread: https://gitlist.dev/t/13084

## k0001, 2008-04-12 20:40

Subject: [BUG] --pretty=format does not work ok with rev-list
Message-ID: <1208032825.30817.15.camel@k0001>
URL: https://gitlist.dev/e/1208032825.30817.15.camel%40k0001

```
Hello list, my name is Renzo Carbonara and I'm new here in the git
neighborhood.


Now back to business, when using --pretty=format:some_format with git
rev-list, an additional non-requested line is printed before every
commit ("commit <sha1_id>"). Example:

git rev-list output (BAD):

k@k0001 ~/linux-2.6 $ git rev-list -2 --pretty=format:"%H: %cn" master
commit f4be31ec9690cfe6e94fcbed6ae60a6a38b3c3ed
f4be31ec9690cfe6e94fcbed6ae60a6a38b3c3ed: Linus Torvalds
commit 44cad261025c04327fd7e847a7088fd3031b0c3e
44cad261025c04327fd7e847a7088fd3031b0c3e: Linus Torvalds


git log output (GOOD):

k@k0001 ~/linux-2.6 $ git log -2 --pretty=format:"%H: %cn" master
f4be31ec9690cfe6e94fcbed6ae60a6a38b3c3ed: Linus Torvalds
44cad261025c04327fd7e847a7088fd3031b0c3e: Linus Torvalds



this was tested with versions:
 - 1.5.3.7
 - 4cdda2b895dfb6ba084e3952cbf4274a6a2e0338


Cheers,

Renzo Carbonara

```

## Jörg Sommer, 2008-04-25 09:14

Subject: Re: [BUG] --pretty=format does not work ok with rev-list
Message-ID: <slrng1386p.ujv.joerg@alea.gnuu.de>
URL: https://gitlist.dev/e/slrng1386p.ujv.joerg%40alea.gnuu.de
In-Reply-To: <1208032825.30817.15.camel@k0001>

```
Hi,

k0001 <gnuk0001@gmail.com> wrote:
> Now back to business, when using --pretty=format:some_format with git
> rev-list, an additional non-requested line is printed before every
> commit ("commit <sha1_id>"). Example:
>
> git rev-list output (BAD):
>
> k@k0001 ~/linux-2.6 $ git rev-list -2 --pretty=format:"%H: %cn" master
> commit f4be31ec9690cfe6e94fcbed6ae60a6a38b3c3ed
> f4be31ec9690cfe6e94fcbed6ae60a6a38b3c3ed: Linus Torvalds
> commit 44cad261025c04327fd7e847a7088fd3031b0c3e
> 44cad261025c04327fd7e847a7088fd3031b0c3e: Linus Torvalds

Is this a bug? I've the same “problem” in my rebase with merge patch
series and added a “|grep -v ^commit”. But if this is a bug, I can remove
it.

Schöne Grüße, Jörg.
-- 
Viele Leute glauben, dass sie denken, wenn sie lediglich
ihre Vorurteile neu ordnen.

```

## Junio C Hamano, 2008-04-25 18:24

Subject: Re: [BUG] --pretty=format does not work ok with rev-list
Message-ID: <7vbq3xpzba.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vbq3xpzba.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <slrng1386p.ujv.joerg@alea.gnuu.de>

```
Jörg Sommer <joerg@alea.gnuu.de> writes:

>> k@k0001 ~/linux-2.6 $ git rev-list -2 --pretty=format:"%H: %cn" master
>> commit f4be31ec9690cfe6e94fcbed6ae60a6a38b3c3ed
>> f4be31ec9690cfe6e94fcbed6ae60a6a38b3c3ed: Linus Torvalds
>> commit 44cad261025c04327fd7e847a7088fd3031b0c3e
>> 44cad261025c04327fd7e847a7088fd3031b0c3e: Linus Torvalds
>
> Is this a bug? I've the same “problem” in my rebase with merge patch
> series and added a “|grep -v ^commit”. But if this is a bug, I can remove
> it.

I personally do not think the above is a particularly desirable output,
but that's how rev-list worked for a long time and existing scripts
probably expect it that way.

rev-list is for script consumption, and giving --pretty=format that has %H
in it would be asking for redundant information.

```
