summaryrefslogtreecommitdiff
path: root/lib/git_unhelpers.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/git_unhelpers.ml')
-rw-r--r--lib/git_unhelpers.ml46
1 files changed, 0 insertions, 46 deletions
diff --git a/lib/git_unhelpers.ml b/lib/git_unhelpers.ml
deleted file mode 100644
index 5b55c16..0000000
--- a/lib/git_unhelpers.ml
+++ /dev/null
@@ -1,46 +0,0 @@
-(* These will be reimplemented using OCaml's Git library, one day... *)
-
-let get_latest_commits repo_path count =
- let open Printf in
- let full_path = Filename.concat Config.git_directory repo_path in
- let full_cmd =
- let command = sprintf "git -C %s log" full_path in
- let options =
- let format = "--pretty=format:'%ad %s'" in
- let date = "--date=short" in
- let count = sprintf "-n %s" (string_of_int count) in
- [ format; date; count ]
- in
- String.concat " " (command :: options)
- in
- let ic = Unix.open_process_in full_cmd in
- let rec read_lines acc =
- try
- let line = input_line ic in
- read_lines (line :: acc)
- with End_of_file ->
- ignore (Unix.close_process_in ic);
- List.rev acc
- in
- read_lines []
-
-let get_all_branches repo_path =
- let open Printf in
- let full_path = Filename.concat Config.git_directory repo_path in
- let full_cmd = sprintf "git -C %s branch" full_path in
- let ic = Unix.open_process_in full_cmd in
- let rec read_lines acc =
- try
- let line = input_line ic |> String.trim in
- let clean_line =
- if String.length line > 2 && String.sub line 0 2 = "* " then
- String.sub line 2 (String.length line - 2)
- (* Remove "* " from active branch *)
- else line
- in
- read_lines (clean_line :: acc)
- with End_of_file ->
- ignore (Unix.close_process_in ic);
- List.rev acc
- in
- read_lines []
Copyright 2019--2025 Marius PETER