Skip to content

Commit

Permalink
Merge pull request ocaml#1028 from AltGr/fix-stats
Browse files Browse the repository at this point in the history
Fixed opam-admin stats for packages in sub-dirs
  • Loading branch information
AltGr committed Dec 10, 2013
2 parents e57241d + 871e728 commit ed41b8c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/scripts/opam_stats.ml
Expand Up @@ -87,7 +87,7 @@ module Git = struct
float_of_string r

let files repo commit dir =
return repo [ "git"; "ls-tree"; commit; dir ^ "/"; "--name-only" ]
return repo [ "git"; "ls-tree"; commit; dir ^ "/"; "--name-only"; "-r" ]

let authors repo commit =
return repo ["git"; "shortlog"; "-sne"; "--no-merges"; commit ]
Expand Down Expand Up @@ -116,7 +116,9 @@ let stats repo =
let files = Git.files repo commit "packages" in
let authors = Git.authors repo commit in
let packages = List.fold_left (fun packages f ->
match OpamPackage.of_string_opt (Filename.basename f) with
if Filename.basename f <> "opam" then packages else
match OpamPackage.of_string_opt (Filename.basename (Filename.dirname f))
with
| None -> packages
| Some nv -> OpamPackage.Set.add nv packages
) OpamPackage.Set.empty files in
Expand Down

0 comments on commit ed41b8c

Please sign in to comment.