From e748516e184d7314f2d54665d957a01c9b6866ad Mon Sep 17 00:00:00 2001 From: Chris Cannam Date: Thu, 17 Oct 2024 09:17:23 +0100 Subject: [PATCH] Update Repoint --- repoint | 20 +++++++++++++++----- repoint.sml | 15 +++++++++++++-- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/repoint b/repoint index ff5aaff..9a69dad 100755 --- a/repoint +++ b/repoint @@ -40,8 +40,11 @@ cleanup_lockfile() { hasher= local_install= +inhibit_local="$mydir/.repoint-inhibit-local-install" if [ -w "$mydir" ]; then - if echo | sha256sum >/dev/null 2>&1 ; then + if [ -f "$inhibit_local" ]; then + : + elif echo | sha256sum >/dev/null 2>&1 ; then hasher=sha256sum local_install=true elif echo | shasum >/dev/null 2>&1 ; then @@ -147,12 +150,19 @@ done case "$sml" in polyml) + interpret=true if [ -n "$local_install" ] && polyc --help >/dev/null 2>&1 ; then - if [ ! -x "$gen_out_exec" ]; then - polyc -o "$gen_out_exec" "$program" + if [ -x "$gen_out_exec" ]; then + "$gen_out_exec" "$@" + interpret="" + elif polyc -o "$gen_out_exec" "$program"; then + "$gen_out_exec" "$@" + interpret="" + else + touch "$inhibit_local" fi - "$gen_out_exec" "$@" - else + fi + if [ -n "$interpret" ]; then echo 'use "'"$program"'"; repoint ['"$arglist"'];' | poly -q --error-exit fi ;; diff --git a/repoint.sml b/repoint.sml index a9332fb..9e18f97 100644 --- a/repoint.sml +++ b/repoint.sml @@ -1485,13 +1485,24 @@ structure GitControl :> VCS_CONTROL = struct let val headfile = FileBits.subpath context libname (".git/refs/remotes/" ^ our_remote ^ "/HEAD") + val () = if FileBits.verbose () + then print ("\n=== " ^ + FileBits.libpath context libname ^ + "\n<<< cat \"" ^ headfile ^ "\"\n") + else () val headspec = FileBits.file_contents headfile in case String.tokens (fn c => c = #" ") headspec of ["ref:", refpath] => (case String.fields (fn c => c = #"/") refpath of "refs" :: "remotes" :: _ :: rest => - String.concatWith "/" rest + let val branch = String.concatWith "/" rest + val () = if FileBits.verbose () + then print (">>> \"" ^ branch ^ "\"\n") + else () + in + branch + end | _ => return_fallback ("Unable to extract default branch from " @@ -3064,7 +3075,7 @@ fun handleSystemArgs args = handle e => ERROR (exnMessage e) end -fun repoint args = +fun repoint args : unit = case handleSystemArgs args of ERROR e => (print ("Error: " ^ e ^ "\n"); OS.Process.exit OS.Process.failure)