swh:1:snp:505c374fd75bb208ae4e9a54e64bb310bc49295e
Raw File
Tip revision: 4676cafde87ba67bab80b4189651fcb4b9a20329 authored by Romain Bardou on 19 November 2020, 16:45:06 UTC
Scripts: add activate-ebetanet.sh
Tip revision: 4676caf
get-git-info.mlt
#!/usr/bin/env ocaml
;;
#load "unix.cma"

let query ~default cmd =
  try
    let chan = Unix.open_process_in cmd in
    let out = input_line chan in
    if Unix.close_process_in chan = Unix.WEXITED 0 then out
    else try Sys.getenv "GIT_SHORTREF" with Not_found -> default
  with End_of_file -> (
    try Sys.getenv "GIT_SHORTREF" with Not_found -> default )

let hash = query ~default:"unknown" "git show -s --pretty=format:%H"

let date = query ~default:"not-available" "git show -s --pretty=format:%ci"

let () =
  Format.printf
    "@[<v>let commit_hash = \"%s\"@,let committer_date = \"%s\"@]@."
    hash
    date
back to top