Re: git log --pretty=format joins lines in the subject of commit message

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

 



On Fri, Sep 17, 2010 at 03:56:53PM +0400, Kirill Likhodedov wrote:

> I think that if it is a feature, it should be reflected in the
> documentation for custom pretty formats.

I agree it should be documented. I'm not sure where, though. The
subject-munging affects more than just pretty formats. For example, at
least git format-patch also has --keep-subjects to turn off munging. I
guess a note should be made in a all relevant places.

> Anyway, that doesn't seem consistent enough: Git knows that the
> subject is "first line\nsecond line\nthird line" (because it shows it
> correctly in full or raw formats). Why does it join the lines in the
> custom format's %s?

Because then the consumer of "git log --format=%s" knows that they will
get exactly one line per commit.

The convention in git is to do "subject\n\nbody", with subject on a
single line. However, we often see commits imported from other version
control systems without this format. The subject-munging is an attempt
to make them useful in git-aware tools (e.g., gitk or gitweb, which show
the subject). Showing just the first line of a multi-line subject is
often useless. People complained, and we got the behavior we have today.

-Peff
--
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]