Closed targi closed 8 years ago
I had the same problem. I solved it by changing the format to match more how the GitHub integration looks like.
# Process the log and escape double quotes; assuming for now that committer names don't have five semicolons in them
log_out=$( git log --pretty=format:"${formattedurl}${commitformat} - %cN" $countarg ${start}..${end} \
| sed ':a;N;$!ba;s/\n/\n/g' \
| sed -e 's/\\/\\\\/g' \
| sed -e 's/"/\\"/g' \
| sed -e 's/\(.*\)\(.*\)/{"title":"","value":"\1","short":false},/' )
fields=${log_out%?}
I've recently set up git-slack-hook on a machine running Debian squeeze. My config looks like this:
Messages from the hook appear garbled, with all commit messages but the last one smashed together:
On my Mac (running OS X 10.10.3), the same configuration works correctly:
Closed investigation reveals that a certain call to
sed
works differently on my Debian machine and on my Mac.On the Mac (as intended):
On the Debian machine (problem):
On the Debian machine, I have GNU sed version 4.2.1.
As I don't need full commit messages in the notification, I replaced the call to
sed
with a no-op:This is obviously a work-around (breaks full commit messages). For reference, it's available at targi/git-slack-hook@2148553cb0c1761948426c49fa42355c76ee4f71.