[X2Go-Commits] [maintenancescripts] 01/08: git/hooks/x2go-post-receive-tag-pending: fix git rev-parse line and properly comment it.
git-admin at x2go.org
git-admin at x2go.org
Tue Mar 3 14:25:53 CET 2020
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch master
in repository maintenancescripts.
commit 4ca837fdb81ab08553b32cf6ced67a52d608faa0
Author: Mihai Moldovan <ionic at ionic.de>
Date: Mon Mar 2 11:00:44 2020 +0100
git/hooks/x2go-post-receive-tag-pending: fix git rev-parse line and properly comment it.
The previous specification was utterly wrong and included refs that
shouldn't have been touched at all.
The crucial part is that we only want that call to emit negated entries,
essentially spanning any tag or branch which the new commits are not
part of, in order to avoid sending duplicated mails in case of merge
operations.
The original call did something entirely different - it correctly
excluded tags, but included the master and release branches during each
individual run, which is not what we wanted.
---
git/hooks/x2go-post-receive-tag-pending | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/git/hooks/x2go-post-receive-tag-pending b/git/hooks/x2go-post-receive-tag-pending
index d796e2f..e2d2a2e 100755
--- a/git/hooks/x2go-post-receive-tag-pending
+++ b/git/hooks/x2go-post-receive-tag-pending
@@ -125,7 +125,18 @@ while read oldrev newrev refname; do
if [[ "${oldrev}" =~ ${null_regex} ]]; then
git_rev_list=( 'git' 'rev-list' '--reverse' '--stdin' "${newrev}" '--not' '--branches=*' '--tags=*' )
fi
- git rev-parse --not --tags --not --branches='master' --branches='release/*' | grep -v "$(git rev-parse ${refname})" | \
+ # Be careful with the "git rev-parse" line.
+ # It is supposed to filter out any commits that are already part of a (different) branch or tag,
+ # in order to not cause duplicated mails on merges.
+ # For this to work, git rev-parse spits out a list of negated tip refs (one per tag/branch), which
+ # are later ignored by git rev-list - including all predecessors.
+ # Since this script runs as a post-receive one, there's one caveat: it will execute after all
+ # branches have been updated, so the new ref(s) will already be incorporated as the new tips of
+ # their respective branches. Incidentally, this means that the pushed tip would be getting
+ # ignored as well, defeating the script's purpose. Hence, we'll manually filter out the negated tip
+ # ref of the current branch (i.e., refname) we're interested in, keeping that one (and that one
+ # only) in the loop.
+ git rev-parse --not --tags --branches | grep -v "$(git rev-parse ${refname})" | \
${git_rev_list[@]} | \
while read rev; do
d="${tempdir}/${rev}.diff"
--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/maintenancescripts.git
More information about the x2go-commits
mailing list