aboutsummaryrefslogtreecommitdiffstats
path: root/deployment/mgagit
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2014-01-04 13:50:49 +0000
committerColin Guthrie <colin@mageia.org>2014-01-04 13:50:49 +0000
commit96129c759a0f5c7f50dbc1af8467e20e311efde6 (patch)
treefac9f5913290cfa3a3848844665484dbba737533 /deployment/mgagit
parent13fe0f0cfea823280fdf2219c4c887c54193bbae (diff)
downloadpuppet-96129c759a0f5c7f50dbc1af8467e20e311efde6.tar
puppet-96129c759a0f5c7f50dbc1af8467e20e311efde6.tar.gz
puppet-96129c759a0f5c7f50dbc1af8467e20e311efde6.tar.bz2
puppet-96129c759a0f5c7f50dbc1af8467e20e311efde6.tar.xz
puppet-96129c759a0f5c7f50dbc1af8467e20e311efde6.zip
mgagit: Attempt to write out a last-modified file for cgit.
This means the Last Modified column in cgit will show the date of the last commit not the date of the last push (which can be completely unrelated, especially when doing rebases or forced pushes and fixups etc.) Note: If we stop using rsync for replication then this can be removed and replaced with a different hook on the receiving side.
Diffstat (limited to 'deployment/mgagit')
-rwxr-xr-xdeployment/mgagit/templates/git-post-receive-hook13
1 files changed, 13 insertions, 0 deletions
diff --git a/deployment/mgagit/templates/git-post-receive-hook b/deployment/mgagit/templates/git-post-receive-hook
index 71235254..d5bff729 100755
--- a/deployment/mgagit/templates/git-post-receive-hook
+++ b/deployment/mgagit/templates/git-post-receive-hook
@@ -167,4 +167,17 @@ class LinksRevision(git_multimail.Revision):
git_multimail.Revision = LinksRevision
if __name__ == '__main__':
+ # Attempt to write a last-updated file for cgit cosmetics
+ try:
+ git_dir = git_multimail.get_git_dir()
+ infowebdir = os.path.join(git_dir, 'info', 'web')
+ if not os.path.exists(infowebdir):
+ os.makedirs(infowebdir)
+ lastupdated = git_multimail.read_git_output(
+ ['for-each-ref', '--sort=-committerdate', "--format='%(committerdate:iso8601)'", '--count=1', 'refs/heads'],
+ )
+ open(os.path.join(infowebdir, 'last-modified'), 'w').write(lastupdated).close()
+ except IOError:
+ pass
+
git_multimail.main(sys.argv[1:])