Skip to content

Commit

Permalink
Slightly more verbose output
Browse files Browse the repository at this point in the history
  • Loading branch information
cannam committed May 24, 2024
1 parent e583799 commit fda716b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
13 changes: 12 additions & 1 deletion 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
13 changes: 12 additions & 1 deletion src/git.sml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,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

0 comments on commit fda716b

Please sign in to comment.