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.

Comments

Josh The Geek’s picture

+++ b/grn.drush.inc
@@ -110,8 +110,13 @@ function _drush_grn_format_changes($issues, $prev_tag, $tag1, $tag2, $git) {
+  if (!drush_shell_exec("%s log -s --format=%s %s..%s", $git, $format, $tag1, $tag2)) {

Needs to be double % with the --format=
Other than that, good.

Powered by Dreditor.

Josh The Geek’s picture

Title: Don't make grn require git >=1.7.3 » Make grn work with git ≤1.7.3
StatusFileSize
new574 bytes

I 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.

jcnventura’s picture

Josh,

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.

jcnventura’s picture

Title: Make grn work with git ≤1.7.3 » Make grn work with git <1.7.3

Josh,

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.

Josh The Geek’s picture

I 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.

Josh The Geek’s picture

I've tested the patch, and using %s is definitely preferable to %B. Can someone with an older version of git test this patch?

Josh The Geek’s picture

Assigned: Unassigned » Josh The Geek

Self assign

jcnventura’s picture

I 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:%s it 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.

Josh The Geek’s picture

Version: 6.x-2.3 » 6.x-2.x-dev
Status: Needs review » Fixed

jcventura: My patch #2 just changes it to %s. Commited. Thanks!

jcnventura’s picture

Status: Fixed » Needs review
StatusFileSize
new1.71 KB

@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.

Josh The Geek’s picture

Title: Make grn work with git <1.7.3 » grn doesn't work with git <1.7.3
Category: feature » bug
Priority: Normal » Major
Status: Needs review » Fixed

Patch looks fine. Commited.
Also, make this a bug report, which it should be.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.