Skip to content
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

diff code with post-receive git hook #10

Open
mandys opened this issue Jul 17, 2020 · 2 comments
Open

diff code with post-receive git hook #10

mandys opened this issue Jul 17, 2020 · 2 comments

Comments

@mandys
Copy link

mandys commented Jul 17, 2020

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']) ) {
    
@mandys
Copy link
Author

mandys commented Jul 17, 2020

Changing line 434
from
git diff-tree --stat --summary --find-copies-harder $oldrev..$newrev

to
git diff $oldrev..$newrev

works.

@zma
Copy link
Owner

zma commented Jul 18, 2020

Changing line 434
from
git diff-tree --stat --summary --find-copies-harder $oldrev..$newrev

to
git diff $oldrev..$newrev

works.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants