[X2Go-Commits] [maintenancescripts] 01/02: git/hooks/update-script._irkerhook.py_: generate list of changed files for exclusively new commits when detecting a new branch/tag (via --new=true) and spit out a pseudo-log message only.

git-admin at x2go.org git-admin at x2go.org
Thu Jan 2 10:35:24 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 50e156b55509af60da8f2467e86be50bc43589a2
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Thu Jan 2 10:25:58 2020 +0100

    git/hooks/update-script._irkerhook.py_: generate list of changed files for exclusively new commits when detecting a new branch/tag (via --new=true) and spit out a pseudo-log message only.
    
    This also includes a modified, rebase-like URL.
---
 git/hooks/update-script._irkerhook.py_ | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/git/hooks/update-script._irkerhook.py_ b/git/hooks/update-script._irkerhook.py_
index b4dda10..0661e6a 100755
--- a/git/hooks/update-script._irkerhook.py_
+++ b/git/hooks/update-script._irkerhook.py_
@@ -334,7 +334,11 @@ class GitExtractor(GenericExtractor):
                 commit.commit = commit.rev
         # Extract the meta-information for the commit
         parent = ''
-        if self.rebase == '':
+        if self.new:
+            # Generate a list of changed files that are part of uniquely new commits.
+            parent = do("git rev-list --reverse -n 1 " + shellquote(commit.commit) + " --not --branches=" + shellquote("*") + " --tags=" + shellquote("*"))
+            commit.files = do("git diff-tree -r --name-only " + shellquote(parent) + " " + shellquote(commit.commit))
+        elif self.rebase == '':
             commit.files = do("git diff-tree -r --name-only " + shellquote(commit.commit))
         else:
             parent = do("git merge-base " + shellquote(self.rebase) + " " + shellquote(commit.commit))
@@ -359,7 +363,7 @@ class GitExtractor(GenericExtractor):
         if self.new:
             ref_type = re.sub(r"^refs/([^/])*/.*", '\1', self.refname)
             ref_type_dict = { "heads": "branch", "tags": "tag" }
-            commit.logmsg = u"{0}{1}".format((u"%(cyan)sNew " + ref_type_dict.get(ref_type, "unknown target") + " \"" + commit.branch +"\" created.%(reset)s Original commit description follows:\n") % self.__dict__, commit.logmsg)
+            commit.logmsg = (u"%(cyan)sNew " + ref_type_dict.get(ref_type, "unknown target") + " \"" + commit.branch +"\" created.%(reset)s New commit description(s) follow:\n") % self.__dict__
         # This discards the part of the author's address after @.
         # Might be be nice to ship the full email address, if not
         # for spammers' address harvesters - getting this wrong
@@ -367,7 +371,7 @@ class GitExtractor(GenericExtractor):
         commit.author = commit.mail.split("@")[0]
         commit.author_date, commit.commit_date = \
             do("git log -1 '--pretty=format:%ai|%ci' " + shellquote(commit.commit)).split("|")
-        if self.rebase != '':
+        if self.rebase != '' or self.new:
             commit.commit = commit.commit + ";hb=" + parent
         return commit
 

--
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