In order to comply with DMARC Groups.io will rewrite the from lines of certain e-mails. We don't want these mangled e-mail addresses in our git repositories. Write an update hook to prevent these from getting into the official repos. Write a pre-commit hook maintainers can add to local repos to prevent bad addresses from being committed in the first place.
I'm going to try to create these starting with the hooks below. https://raw.githubusercontent.com/asadana/Git-Check-Author/master/pre-commit https://raw.githubusercontent.com/asadana/Git-Check-Author/master/pre-receive
I don't know how to get git to reject local commits with incorrect addresses in as the git committer name isn't passed to any of the suitable hooks. I did have more success with the server side blocking. The poky repo now has a pre-receive hook that successfully prevents 'bad' user names from being pushed.
Locally the best I've been able to come up with is a post-applypatch which does: #!/bin/bash authorName=$(git log -1 --pretty=format:%an HEAD) if [[ "$authorName" == *"Openembedded-core"* ]]; then echo "####################################################################" echo "####################################################################" echo "Invalid Author $authorName" echo "####################################################################" echo "####################################################################" git reset HEAD~1 --hard fi
Richard's pre-receive hook is deployed on the OpenEmbeddeded and Yocto Project servers now.
When applying patches I'm finding the easiest fix when hitting the warning is to swap the From and Reply-To: headers and git-am will then process the emails correctly. Ultimately I'll script that.
I just tried pushing to stable/zeus-nut and got this error. The offending commit is already in mainline zeus. akuster@akuster-ThinkPad-T460s:~/oss/stable/poky$ git push -f ssh://git@git.yoctoproject.org/poky-contrib.git stable/zeus-nut:stable/zeus-nut Counting objects: 399, done. Delta compression using up to 4 threads. Compressing objects: 100% (187/187), done. Writing objects: 100% (399/399), 77.11 KiB | 12.85 MiB/s, done. Total 399 (delta 296), reused 284 (delta 206) remote: Resolving deltas: 100% (296/296), completed with 100 local objects. remote: ############################################## remote: Invalid author Taras Kondratiuk via Openembedded-core remote: ############################################## To ssh://git.yoctoproject.org/poky-contrib.git ! [remote rejected] stable/zeus-nut -> stable/zeus-nut (pre-receive hook declined)
Armin, are you confirming this is working as expected or reporting a problem? Separately you need to update your remote to ssh://git@push.yoctoproject.org/poky-contrib.git to ensure reliable pushes in the future.
(In reply to comment #7) > Armin, are you confirming this is working as expected or reporting a problem? > > Separately you need to update your remote to > ssh://git@push.yoctoproject.org/poky-contrib.git to ensure reliable pushes > in the future. I reported a problem. Richard fixed it and things are good now. thanks.
I think given the hooks installed and updated workflow tweaks people can use we've resolved this as best we can now.