summary refs log tree commit diff stats
path: root/git-hooks
diff options
context:
space:
mode:
Diffstat (limited to 'git-hooks')
-rwxr-xr-xgit-hooks/post-receive9
1 files changed, 6 insertions, 3 deletions
diff --git a/git-hooks/post-receive b/git-hooks/post-receive
index 2b14572..f490cf9 100755
--- a/git-hooks/post-receive
+++ b/git-hooks/post-receive
@@ -188,7 +188,7 @@ for c in changes:
         tree = gen_dir / "trees" / str(repo[c.new_value].tree_id)
         with index.open("w") as f:
             # TODO
-            f.write("<!DOCTYPE html><html><head><meta charset=\"utf-8\"><title>ref</title><body><a href=\"./tree\">view tree</a></body></html>")
+            f.write("<!DOCTYPE html><html><head><meta charset=\"utf-8\"><title>ref</title><body><a href=\"./tree\">view tree</a> <a href=\"{}../commits/{}\">view commit</a></body></html>".format("".join("../" for x in c.ref_name if x == "/"), c.new_value))
         todocommits.add(repo[c.new_value])
         linktarget = get_relative(path, tree)
         link.unlink(missing_ok=True)
@@ -213,7 +213,7 @@ for ref in repo.references:
         continue
     with f:
         # TODO
-        f.write("<!DOCTYPE html><html><head><meta charset=\"utf-8\"><title>ref</title><body><a href=\"./tree\">view tree</a></body></html>")
+        f.write("<!DOCTYPE html><html><head><meta charset=\"utf-8\"><title>ref</title><body><a href=\"./tree\">view tree</a> <a href=\"{}../commits/{}\">view commit</a></body></html>".format("".join("../" for x in ref.name if x == "/"), ref.peel(pygit2.Commit).id))
     todocommits.add(ref.peel(pygit2.Commit))
     linktarget = get_relative(path, tree)
     link.symlink_to(linktarget, target_is_directory=True)
@@ -239,7 +239,10 @@ while todocommits:
         continue
     with f:
         # TODO
-        f.write("<!DOCTYPE html><html><head><meta charset=\"utf-8\"><title>commit</title><body><a href=\"./tree\">view tree</a></body></html>")
+        f.write("<!DOCTYPE html><html><head><meta charset=\"utf-8\"><title>commit</title><body><a href=\"./tree\">view tree</a><ul>")
+        for parent in c.parents:
+            f.write("<li><a href=\"../{}\">{}</a></li>".format(str(parent.id), str(parent.id)))
+        f.write("</ul></body></html>")
     todotrees.add(c.tree)
     todocommits.update(c.parents)
     linktarget = get_relative(path, tree)