2

I have exported git log data into a CSV, however the files modified aren't part of a placeholder

eg :

git log --after=date --pretty=format:%ad,%s,%H,%ae,%an,%b --name-only

I'm able to get the correct data as CSV except , files are present in the next line and not at the end as needed

current output

Thu Apr 19 13:35:51 2018 +0000  books author  cr : xyz@ 625d76807af57776bc94e36627f352e92e00eb01    mike@mike.com   Mike    cr https://reviews/CR-1346

configuration/data/feeds/xmlcoverage/xyz.txt                    
configuration/data/feeds/xmlcoverage/log/abc.txt        

except for the filenames (abc.txt and xyz.txt , rest appear in individual cells)

Is there a placeholder for files?
If not, can I move the files to the same line in the CSV as others?

1 Answers1

1

Is there a placeholder for files?

No.

If not, can I move the files to the same line in the CSV as others?

Not without parsing. And instead of parsing I recommend to construct the output using git rev-list + git show. In your case it is something like

git rev-list -after=date master |
    while read sha1; do
        subject=`git show -s --format='%ad,%s,%H,%ae,%an,%b'`
        files=`git show --format='' --name-only | tr '\n' ' '`
        echo "$subject$files"
    done

This approach still has a problematic point — what if subject (%s) contains commas? The output will contain too much commas.

phd
  • 82,685
  • 13
  • 120
  • 165