diff options
Diffstat (limited to 'lib/git_unhelpers.ml')
-rw-r--r-- | lib/git_unhelpers.ml | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/git_unhelpers.ml b/lib/git_unhelpers.ml new file mode 100644 index 0000000..28d4d3a --- /dev/null +++ b/lib/git_unhelpers.ml @@ -0,0 +1,19 @@ +(* These will be reimplemented using OCaml's Git library, one day... *) + +let get_git_log repo_path = + let full_path = Filename.concat Config.git_directory repo_path in + let full_cmd = + let cmd = Printf.sprintf "git -C %s log" full_path in + let options = [ "--pretty=format:'%ad %s'"; "--date=short"; "-n 10" ] in + String.concat " " (cmd :: 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 [] |