diff code with post-receive git hook
mandys opened this issue · 2 comments
Hi,
Thank you for the post-receive git hook for sending out an email notification.
I see the following in email
Summary of changes:
test_file_2 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Is it possible to send out an actual diff of code that changed ?
Below is just a random example...
diff --git a/test_file_2 b/test_file_2
index 89a15f8..24db903 100644
--- a/test_file_2
+++ b/test_file_2
@@ -176,7 +176,7 @@ class FacebookService
-
} elseif(!empty($_POST['signed_request'])) {
-
} elseif(!empty($_POST['signed_request']) && !empty($_POST['appid']) ) {
Changing line 434
from
git diff-tree --stat --summary --find-copies-harder $oldrev..$newrev
to
git diff $oldrev..$newrev
works.
Changing line 434
from
git diff-tree --stat --summary --find-copies-harder $oldrev..$newrevto
git diff $oldrev..$newrevworks.
Cool. This is useful (but be aware this may generate large emails).
If it can be configured by configs, it may be better. One idea is to use a config like hooks.diffresult
("" or "summary" for the summary; or "fulldiff" for the full git diff
) to control the behavior.
If you or anyone would like to make a PR, I will be happy to merge.