I've created a hook that sends out notification emails when a developer pushes an update to his shared repository. This email includes a list of changed files, example:
A __classes/Page/Activity.php
M __config/Scheme.php
that I generate using the following bit of bash:
$(git diff "$newrev"^ "$newrev" --name-status)
This works fine. However, I'm trying to port all this now to the well-known post-receive-email hook. This hook does have a hooks.showrev
configuration directive, but this I think this only allows for the revision number (%s
) to be used once in the command. So this doesn't work:
showrev = "git diff %s^ %s --name-status"
There must be a 'plumbing' command that does just this. Can anyone point me in the right direction? :)
How about using the following?
showrev = "git show --name-status --pretty=format: %s"
git show
is porcelain rather than plumbing, but I think this is what you want.
git whatchanged -1 <rev>
might be a good starting point, and has a number of additional options for massaging the output format. Not sure you can get exactly the format you quoted above, but you should be able to get something comparable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With