Skip to content

Commit

Permalink
Update Repoint
Browse files Browse the repository at this point in the history
  • Loading branch information
cannam committed Oct 17, 2024
1 parent a40ad98 commit e748516
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
20 changes: 15 additions & 5 deletions repoint
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 ;;
Expand Down
15 changes: 13 additions & 2 deletions repoint.sml
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit e748516

Please sign in to comment.