Skip to content

Commit 850fb84

Browse files
committed
admincommand: factorise some to_dir functions calls
1 parent bcd4453 commit 850fb84

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/client/opamAdminCommand.ml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ let index_command cli =
7979
in
8080
let cmd global_options urls_txt () =
8181
OpamArg.apply_global_options cli global_options;
82-
let repo_root = checked_repo_root () in
82+
let repo_root = checked_repo_root () in
83+
let repo_root_dir = OpamRepositoryRoot.Dir.to_dir repo_root in
8384
let repo_file = OpamRepositoryPath.repo repo_root in
8485
let repo_def =
8586
match OpamFile.Repo.read_opt repo_file with
@@ -103,8 +104,7 @@ let index_command cli =
103104
| Some vcs ->
104105
let module VCS = (val OpamRepository.find_backend_by_kind vcs) in
105106
match
106-
OpamProcess.Job.run
107-
(VCS.revision (OpamRepositoryRoot.Dir.to_dir repo_root))
107+
OpamProcess.Job.run (VCS.revision repo_root_dir)
108108
with
109109
| None -> date ()
110110
| Some hash -> hash
@@ -116,15 +116,13 @@ let index_command cli =
116116
OpamFilename.of_string "repo" ::
117117
(if urls_txt = `full_urls_txt then
118118
OpamFilename.rec_files
119-
OpamFilename.Op.(OpamRepositoryRoot.Dir.to_dir repo_root /
120-
"compilers") @
119+
OpamFilename.Op.(repo_root_dir / "compilers") @
121120
OpamFilename.rec_files (OpamRepositoryPath.packages_dir repo_root)
122121
else []) |>
123122
List.fold_left (fun set f ->
124123
if not (OpamFilename.exists f) then set else
125124
let attr =
126-
OpamFilename.to_attribute
127-
(OpamRepositoryRoot.Dir.to_dir repo_root) f
125+
OpamFilename.to_attribute repo_root_dir f
128126
in
129127
OpamFilename.Attribute.Set.add attr set
130128
) OpamFilename.Attribute.Set.empty |>

0 commit comments

Comments
 (0)