-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gitlog fails when the subject or body includes quotation marks #101
Comments
Having the same issue. In the meantime is there a way that client code can specify the format to remove subject and body? |
In case this helps anyone, you can set the format in the config file to exclude subject and body (assuming you dont need it) and it wont break the json parser. module.exports = function (options) { |
@nburana the problem persists if you need that field... |
Yeah totally. We just needed the hash and the date so this worked for us. |
Looking into the source-code it will be difficult to fix this if we don't do a more granular parsing of the git log output. function escape_chars {
sed -r 's/(\{\}")/\\\1/g'
}
function format {
sha=$(git log -n1 --pretty=format:%h $1 | escape_chars)
message=$(git log -n1 --pretty=format:%B $1 | escape_chars)
author=$(git log -n1 --pretty=format:'%aN <%aE>' $1 | escape_chars)
commit=$(git log -n1 --pretty=format:%cE $1 | escape_chars)
date=$(git log -n1 --pretty=format:%cD $1 | escape_chars)
echo "{\"sha\":\"$sha\",\"message\":\"$message\",\"author\":\"$author\",\"commit\":\"$commit\",\"date\":\"$date\"}"
}
for hash in $(git rev-list)
do
format $hash
done Not sure if this would be too much overhead for this task. |
Has anyone found a reasonable work around for this. Would anyone benefit from me submitting a PR? If this comment gets a reasonable amount of notice I'll submit something. |
When running the task it fails with the following error:
Is there any way to escape the values before parsing the json?
The text was updated successfully, but these errors were encountered: