Hi,
Contrary to webchick, I don't want to update my git version just to run grn.. As such, I've created some code to use the %s for git < 1.7.3, keeping the use of the %B format for >=1.7.3.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | oldergits-1077938-10.patch | 1.71 KB | jcnventura |
| #2 | grn_1077938_2.patch | 574 bytes | Josh The Geek |
| grn_git_171.patch | 905 bytes | jcnventura |
Comments
Comment #1
Josh The Geek commentedNeeds to be double % with the --format=
Other than that, good.
Powered by Dreditor.
Comment #2
Josh The Geek commentedI didn't know what subject is, but it'll work better. With some testing, line breaks in commit messages don't show up as new messages in output, but continuations of previous line. So, see attached patch.
Comment #3
jcnventuraJosh,
Please review my original patch again.. The logic there is that if git version is lower than 1.7.3, then the format will be "%s", other than it will be "%B" (like it was originally). So for 1.7.1 users (as shipped with Ubuntu 10.10), indeed line breaks in commit messages won't show up. For 1.7.3+, those breaks will show up.
That's why there's a new $format parameter and that's why the --format=%s doesn't need a double %% (as requested in #1). The patch in #2, denies that logic and won't be so pretty for git 1.7.3+ users.
Comment #4
jcnventuraJosh,
If you want, I can co-maintain this with you. :)
Also, fixing the title accuracy, as it works fine with git 1.7.3 already.
Comment #5
Josh The Geek commentedI noticed that, I just wasn't really paying attention. Still, I would like to use %s (subject) for everything, because I don't want line breaks to appear as new messages, but a continuation from the first. Therefore, %s is better. Tested (#2), should I commit?
Thanks for the offer, if I need someone in the future, I'll let you.
Comment #6
Josh The Geek commentedI've tested the patch, and using %s is definitely preferable to %B. Can someone with an older version of git test this patch?
Comment #7
Josh The Geek commentedSelf assign
Comment #8
jcnventuraI just checked the documentation (http://www.kernel.org/pub/software/scm/git/docs/v1.5.1.6/git-log.html) and if we use
--pretty=format:%sit should work all the way from v 1.5.1.6 to the latest release..git 1.5.1.6 was released around May 2007, so we should be pretty safe with using that option. I'll try to create a patch soon.
Comment #9
Josh The Geek commentedjcventura: My patch #2 just changes it to %s. Commited. Thanks!
Comment #10
jcnventura@Josh The Geek: sorry to reopen this, but would you consider using the old format "--pretty=format:%s" instead? According to the git docs, the "--format" was only introduced in version 1.6.3.4 (July 2009).
It doesn't cost anything to change this and would increase compatibility with some git versions.
Comment #11
Josh The Geek commentedPatch looks fine. Commited.
Also, make this a bug report, which it should be.