summaryrefslogtreecommitdiff
path: root/lib/views/repo.ml
diff options
context:
space:
mode:
authorMarius Peter <marius.peter@tutanota.com>2025-01-26 19:18:20 +0100
committerMarius Peter <marius.peter@tutanota.com>2025-01-26 19:18:20 +0100
commit36c8f580659be0586413e3bfc891173fff3edd21 (patch)
tree84ef541a7b33550e427147dc3cf27d5fcb2370f8 /lib/views/repo.ml
parent1793a47597d9813812f3715c55e6ec8a923274e6 (diff)
Update views.
This doesn't even work. Why is OCaml so complicated?!
Diffstat (limited to 'lib/views/repo.ml')
-rw-r--r--lib/views/repo.ml38
1 files changed, 0 insertions, 38 deletions
diff --git a/lib/views/repo.ml b/lib/views/repo.ml
deleted file mode 100644
index 7fefce8..0000000
--- a/lib/views/repo.ml
+++ /dev/null
@@ -1,38 +0,0 @@
-open Dream_html
-open HTML
-open Git_unix (* Import Git_unix for working with repositories *)
-
-let git_directory = Filename.concat (Unix.getenv "HOME") "git"
-let repo_path repo_name = Filename.concat git_directory repo_name
-
-let list_commits repo_name =
- let repo_dir = repo_path repo_name in
- if Sys.file_exists repo_dir && Sys.is_directory repo_dir then
- let store = Store.v (Fpath.v repo_dir) |> Result.get_ok in
- let head = Store.Head.get store |> Result.get_ok in
- let rec read_commits commits acc =
- match commits with
- | [] -> acc
- | hash :: rest ->
- let commit = Store.read_commit store hash |> Result.get_ok in
- let hash_str = Hash.to_hex hash in
- let message = Commit.message commit in
- let author = Commit.author commit in
- let date = Commit.date commit in
- let formatted_commit =
- li []
- [
- txt (Printf.sprintf "%s - %s (%s)" hash_str message author);
- txt (" on " ^ date);
- ]
- in
- read_commits rest (formatted_commit :: acc)
- in
- let all_commits = Store.Commit.list store head in
- ul [] (read_commits all_commits [])
- else ul [] [ li [] [ txt "Error: Repository not found." ] ]
-
-(* Render the repository's commit list as HTML *)
-let render repo_name =
- let commits = list_commits repo_name in
- Layouts.application ~page_title:("Commits for " ^ repo_name) commits
Copyright 2019--2025 Marius PETER