Skip to content

Commit

Permalink
Merge pull request #166 from TheLortex/fix-get-default-branch
Browse files Browse the repository at this point in the history
Fix git default branch computation
  • Loading branch information
NathanReb authored May 5, 2021
2 parents 1d59e54 + ac3cf44 commit b32aadd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

### Fixed

- Fix the default branch mechanism when the opam remote starts with `git+https` (#166, @TheLortex)
- Fix a log that was still refering to the old tool name `duniverse` (#158, @rizo)
- Improve how the default branch for a git repository is queried, fixing a bug
where opam-monorepo wouldn't work outside of of git repo and a bug where it wouldn't
Expand Down
10 changes: 5 additions & 5 deletions cli/lock.ml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ let check_root_packages ~local_packages =
local_packages Pp.plural local_packages);
Ok ()

let opam_to_git_remote remote =
match String.lsplit2 ~on:'+' remote with Some ("git", remote) -> remote | _ -> remote

let compute_duniverse ~package_summaries =
let get_default_branch remote = Exec.git_default_branch ~remote () in
let get_default_branch remote = Exec.git_default_branch ~remote:(opam_to_git_remote remote) () in
Duniverse.from_package_summaries ~get_default_branch package_summaries

let resolve_ref deps =
let resolve_ref ~repo ~ref =
let repo = match String.lsplit2 ~on:'+' repo with Some ("git", repo) -> repo | _ -> repo in
Exec.git_resolve ~remote:repo ~ref
in
let resolve_ref ~repo ~ref = Exec.git_resolve ~remote:(opam_to_git_remote repo) ~ref in
Duniverse.resolve ~resolve_ref deps

let current_repos ~repo_state ~switch_state =
Expand Down

0 comments on commit b32aadd

Please sign in to comment.