3

We follow a commit message policy that allows us to parse git log for release notes.

[category US123] Description of what is changed

eg:

  • [feature US123] Added the version number to the meta:version tag of every page. Better for support.
  • [dev US123] remove development entries before production
  • [settings US123] New STS webservice url for UAT

The bash script below parses the log, but there's a trailing number after each user story / defect.

Is this a side effect of awk? What needs to change to remove the trailing number?

git log -100 --pretty="%s" | grep -io "\(DE\|US\)[0-9]\{3,\}" | sort | uniq | awk '{print $1; print system("git log --pretty=\"%cI %an %s\" | grep -i -v \"Merge\" | grep -i "$1)}'

enter image description here

2
  • 1
    that is probably because of system function you called inside awk. This could be done in some other way if you provide sample input text and desired output data. Commented Oct 6, 2016 at 7:02
  • Could you provide us some example of commit messages? Commented Oct 6, 2016 at 7:46

1 Answer 1

2

You have to replace print system(...) with just system(...):

git log -100 --pretty="%s" | grep -io "\(DE\|US\)[0-9]\{3,\}" | sort | uniq | awk '{print $1; system("git log --pretty=\"%cI %an %s\" | grep -i -v \"Merge\" | grep -i "$1)}'

system() function prints to stdout by itself, when you call print system(...) you actually print exit code returned by system().

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! That nailed it.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.