1 diff --git a/OMakefile b/OMakefile
2 index 92de085..dc34346 100644
5 @@ -25,8 +25,8 @@ OCAML_CLIBS += ometastore_stub
6 OCAML_OTHER_LIBS += unix str
8 OCamlProgram(ometastore, folddir util ometastore)
9 -OCamlProgram(find-git-repos, folddir util find-git-repos)
10 -OCamlProgram(find-git-files, folddir util find-git-files)
11 +OCamlProgram(find-git-repos, folddir util findrepos)
12 +OCamlProgram(find-git-files, folddir util find)
14 .DEFAULT: ometastore find-git-files find-git-repos
16 diff --git a/find-git-files.ml b/find-git-files.ml
17 deleted file mode 100644
18 index f2881aa..0000000
19 --- a/find-git-files.ml
22 -(* Copyright (C) 2008 Mauricio Fernandez <mfp@acm.org> http//eigenclass.org
23 - * See README.txt and LICENSE for the redistribution and modification terms *)
30 -let debug = ref false
32 -module Find(F : Folddir.S) =
34 - let find ?(debug=false) ?(sorted=false) path =
35 - let aux l name stat =
36 - let dir = join path name in
37 - match stat.st_kind with
39 - try access (join dir ".git") [F_OK]; Prune (name :: l)
40 - with Unix_error _ -> Continue (name :: l)
42 - | _ -> Continue (name :: l)
43 - in List.rev (F.fold_directory ~debug ~sorted aux [] path "")
46 -module Gitignored = Find(Folddir.Make(Folddir.Gitignore))
49 - let usage = "Usage: find-git-files <options>" in
50 - let path = ref "." in
51 - let zerosep = ref false in
52 - let sorted = ref false in
54 - "--path", Arg.Set_string path, "Set base path (default: .)";
55 - "-z", Arg.Set zerosep, "Use \\0 to separate filenames.";
56 - "-s", Arg.Set sorted, "Sort output.";
57 - "--debug", Arg.Set debug, "Debug mode"
60 - Arg.parse specs ignore usage;
61 - let print = if !zerosep then printf "%s\000" else printf "%s\n" in
62 - List.iter print (Gitignored.find ~debug:!debug ~sorted:!sorted !path)
65 diff --git a/find-git-repos.ml b/find-git-repos.ml
66 deleted file mode 100644
67 index 6db674b..0000000
68 --- a/find-git-repos.ml
71 -(* Copyright (C) 2008 Mauricio Fernandez <mfp@acm.org> http//eigenclass.org
72 - * See README.txt and LICENSE for the redistribution and modification terms *)
79 -let debug = ref false
81 -module Findrepos(F : Folddir.S) =
83 - let find_repositories ?(debug=false) path =
84 - let aux l name stat =
85 - let dir = join path name in
86 - match stat.st_kind with
88 - try access (join dir ".git") [F_OK]; Prune (name :: l)
89 - with Unix_error _ -> Continue l
92 - in List.sort compare (F.fold_directory ~debug aux [] path "")
95 -module All = Findrepos(Folddir.Make(Folddir.Ignore_none))
96 -module Gitignored = Findrepos(Folddir.Make(Folddir.Gitignore))
99 - let usage = "Usage: find-git-repos <options>" in
100 - let path = ref "." in
101 - let find_repos = ref All.find_repositories in
102 - let zerosep = ref false in
103 - let sorted = ref false in
105 - "--path", Arg.Set_string path, "Set base path (default: .)";
106 - "-i", Arg.Unit (fun () -> find_repos := Gitignored.find_repositories),
107 - "Mimic git semantics (honor .gitignore, don't scan git submodules)";
108 - "-z", Arg.Set zerosep, "Use \\0 to separate filenames.";
109 - "-s", Arg.Set sorted, "Sort output.";
110 - "--debug", Arg.Set debug, "Debug mode"
112 - in Arg.parse specs ignore usage;
113 - let print = if !zerosep then printf "%s\000" else printf "%s\n" in
114 - let l = !find_repos ~debug:!debug !path in
115 - List.iter print (if !sorted then List.sort compare l else l)
118 diff --git a/find.ml b/find.ml
120 index 0000000..f2881aa
124 +(* Copyright (C) 2008 Mauricio Fernandez <mfp@acm.org> http//eigenclass.org
125 + * See README.txt and LICENSE for the redistribution and modification terms *)
132 +let debug = ref false
134 +module Find(F : Folddir.S) =
136 + let find ?(debug=false) ?(sorted=false) path =
137 + let aux l name stat =
138 + let dir = join path name in
139 + match stat.st_kind with
141 + try access (join dir ".git") [F_OK]; Prune (name :: l)
142 + with Unix_error _ -> Continue (name :: l)
144 + | _ -> Continue (name :: l)
145 + in List.rev (F.fold_directory ~debug ~sorted aux [] path "")
148 +module Gitignored = Find(Folddir.Make(Folddir.Gitignore))
151 + let usage = "Usage: find-git-files <options>" in
152 + let path = ref "." in
153 + let zerosep = ref false in
154 + let sorted = ref false in
156 + "--path", Arg.Set_string path, "Set base path (default: .)";
157 + "-z", Arg.Set zerosep, "Use \\0 to separate filenames.";
158 + "-s", Arg.Set sorted, "Sort output.";
159 + "--debug", Arg.Set debug, "Debug mode"
162 + Arg.parse specs ignore usage;
163 + let print = if !zerosep then printf "%s\000" else printf "%s\n" in
164 + List.iter print (Gitignored.find ~debug:!debug ~sorted:!sorted !path)
167 diff --git a/findrepos.ml b/findrepos.ml
169 index 0000000..6db674b
173 +(* Copyright (C) 2008 Mauricio Fernandez <mfp@acm.org> http//eigenclass.org
174 + * See README.txt and LICENSE for the redistribution and modification terms *)
181 +let debug = ref false
183 +module Findrepos(F : Folddir.S) =
185 + let find_repositories ?(debug=false) path =
186 + let aux l name stat =
187 + let dir = join path name in
188 + match stat.st_kind with
190 + try access (join dir ".git") [F_OK]; Prune (name :: l)
191 + with Unix_error _ -> Continue l
194 + in List.sort compare (F.fold_directory ~debug aux [] path "")
197 +module All = Findrepos(Folddir.Make(Folddir.Ignore_none))
198 +module Gitignored = Findrepos(Folddir.Make(Folddir.Gitignore))
201 + let usage = "Usage: find-git-repos <options>" in
202 + let path = ref "." in
203 + let find_repos = ref All.find_repositories in
204 + let zerosep = ref false in
205 + let sorted = ref false in
207 + "--path", Arg.Set_string path, "Set base path (default: .)";
208 + "-i", Arg.Unit (fun () -> find_repos := Gitignored.find_repositories),
209 + "Mimic git semantics (honor .gitignore, don't scan git submodules)";
210 + "-z", Arg.Set zerosep, "Use \\0 to separate filenames.";
211 + "-s", Arg.Set sorted, "Sort output.";
212 + "--debug", Arg.Set debug, "Debug mode"
214 + in Arg.parse specs ignore usage;
215 + let print = if !zerosep then printf "%s\000" else printf "%s\n" in
216 + let l = !find_repos ~debug:!debug !path in
217 + List.iter print (if !sorted then List.sort compare l else l)