Blob


1 .\"
2 .\" Copyright (c) 2021 Stefan Sperling
3 .\"
4 .\" Permission to use, copy, modify, and distribute this software for any
5 .\" purpose with or without fee is hereby granted, provided that the above
6 .\" copyright notice and this permission notice appear in all copies.
7 .\"
8 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 .\"
16 .Dd $Mdocdate$
17 .Dt GOTADMIN 1
18 .Os
19 .Sh NAME
20 .Nm gotadmin
21 .Nd Game of Trees repository administration
22 .Sh SYNOPSIS
23 .Nm
24 .Ar command
25 .Op Fl h
26 .Op Ar arg ...
27 .Sh DESCRIPTION
28 .Nm
29 is the repository maintenance tool for the
30 .Xr got 1
31 version control system.
32 .Pp
33 .Xr got 1
34 stores the history of tracked files in a Git repository, as used
35 by the Git version control system.
36 .Nm
37 provides commands for inspecting and manipulating the on-disk state of
38 Git repositories.
39 The repository format is described in
40 .Xr git-repository 5 .
41 .Pp
42 .Nm
43 provides global and command-specific options.
44 Global options must precede the command name, and are as follows:
45 .Bl -tag -width tenletters
46 .It Fl h
47 Display usage information and exit immediately.
48 .It Fl V , -version
49 Display program version and exit immediately.
50 .El
51 .Pp
52 The commands for
53 .Nm
54 are as follows:
55 .Bl -tag -width checkout
56 .It Cm init Ar repository-path
57 Create a new empty repository at the specified
58 .Ar repository-path .
59 .Pp
60 After
61 .Cm gotadmin init ,
62 the
63 .Cm got import
64 command must be used to populate the empty repository before
65 .Cm got checkout
66 can be used.
67 .It Cm info Oo Fl r Ar repository-path Oc
68 Display information about a repository.
69 This includes some configuration settings from
70 .Xr got.conf 5 ,
71 and the number of objects stored in the repository, in packed or
72 loose form, as well as the current on-disk size of these objects.
73 .Pp
74 The options for
75 .Cm gotadmin info
76 are as follows:
77 .Bl -tag -width Ds
78 .It Fl r Ar repository-path
79 Use the repository at the specified path.
80 If not specified, assume the repository is located at or above the current
81 working directory.
82 If this directory is a
83 .Xr got 1
84 work tree, use the repository path associated with this work tree.
85 .El
86 .It Cm pack Oo Fl a Oc Oo Fl r Ar repository-path Oc Oo Fl x Ar reference Oc Oo Fl q Oc Op Ar reference ...
87 Generate a new pack file and a corresponding pack file index.
88 By default, add any loose objects which are reachable via any references
89 to the generated pack file.
90 .Pp
91 If one or more
92 .Ar reference
93 arguments is specified, only add objects which are reachable via the specified
94 references.
95 Each
96 .Ar reference
97 argument may either specify a specific reference or a reference namespace,
98 in which case all references within this namespace will be used.
99 .Pp
100 .Cm gotadmin pack
101 always ignores references in the
102 .Pa refs/got/
103 namespace, effectively treating such references as if they did not refer
104 to any objects.
105 .Pp
106 The options for
107 .Cm gotadmin pack
108 are as follows:
109 .Bl -tag -width Ds
110 .It Fl a
111 Add objects to the generated pack file even if they are already packed
112 in a different pack file.
113 Unless this option is specified, only loose objects will be added.
114 .It Fl r Ar repository-path
115 Use the repository at the specified path.
116 If not specified, assume the repository is located at or above the current
117 working directory.
118 If this directory is a
119 .Xr got 1
120 work tree, use the repository path associated with this work tree.
121 .It Fl x Ar reference
122 Exclude objects reachable via the specified
123 .Ar reference
124 from the pack file.
125 The
126 .Ar reference
127 argument may either specify a specific reference or a reference namespace,
128 in which case all references within this namespace will be excluded.
129 The
130 .Fl x
131 option may be specified multiple times to build a list of references to exclude.
132 .Pp
133 Exclusion takes precedence over inclusion.
134 If a reference appears in both the included and excluded lists, it will
135 be excluded.
136 .It Fl q
137 Suppress progress reporting output.
138 .El
139 .Tg ix
140 .It Cm indexpack Ar packfile-path
141 .Dl Pq alias: Cm ix
142 Create a pack index for the pack file at
143 .Ar packfile-path .
144 .Pp
145 A pack index is required for using the corresponding pack file with
146 .Xr got 1 .
147 Usually, a pack index will be created by commands such as
148 .Cm gotadmin pack
149 or
150 .Cm got fetch
151 as part of regular operation.
152 The
153 .Cm gotadmin indexpack
154 command may be used to recover from a corrupt or missing index.
155 A given pack file will always yield the same bit-identical index.
156 .Pp
157 The provided
158 .Ar packfile-path
159 must be located within the
160 .Pa objects/pack/
161 directory of the repository and should end in
162 .Pa .pack .
163 The filename of the corresponding pack index is equivalent, except
164 that it ends in
165 .Pa .idx .
166 .Tg ls
167 .It Cm listpack Oo Fl h Oc Oo Fl s Oc Ar packfile-path
168 .Dl Pq alias: Cm ls
169 List the contents of the pack file at
170 .Ar packfile-path .
171 .Pp
172 Each object contained in the pack file will be displayed on a single line.
173 The information shown includes the object ID, object type, object offset,
174 and object size.
175 .Pp
176 If a packed object is deltified against another object, the delta base
177 will be shown as well.
178 For offset deltas, the delta base is identified via an offset into the
179 pack file.
180 For reference deltas, the delta base is identified via an object ID.
181 .Pp
182 The provided
183 .Ar packfile-path
184 must be located within the
185 .Pa objects/pack/
186 directory of the repository and should end in
187 .Pa .pack .
188 The corresponding pack index must exist and can be created with
189 .Cm gotadmin indexpack
190 if it is missing.
191 .Pp
192 The options for
193 .Cm gotadmin listpack
194 are as follows:
195 .Bl -tag -width Ds
196 .It Fl h
197 Show object sizes in human-readable form.
198 .It Fl s
199 Display statistics about the pack file after listing objects.
200 This includes the total number of objects stored in the pack file
201 and a break-down of the number of objects per object type.
202 .El
203 .Tg cl
204 .It Cm cleanup Oo Fl a Oc Oo Fl p Oc Oo Fl n Oc Oo Fl r Ar repository-path Oc Oo Fl q Oc
205 .Dl Pq alias: Cm cl
206 Purge unreferenced loose objects from the repository and display
207 the amount of disk space which has been freed as a result.
208 .Pp
209 Unreferenced objects are present in the repository but cannot be
210 reached via any reference in the entire
211 .Pa refs/
212 namespace.
213 .Pp
214 Loose objects are stored as individual files beneath the repository's
215 .Pa objects/
216 directory,
217 spread across 256 sub-directories named after the 256 possible
218 hexadecimal values of the first byte of an object identifier.
219 .Pp
220 Packed objects stored in pack files under
221 .Pa objects/pack/
222 will not be purged.
223 However, if redundant copies of packed objects exist in loose form,
224 such redundant copies will be purged.
225 .Pp
226 Objects will usually become unreferenced as a result of deleting
227 branches or tags with
228 .Cm got branch -d
229 or
230 .Cm got tag -d .
231 Deleting arbitrary references with
232 .Cm got ref -d
233 may also leave unreferenced objects behind.
234 .Pp
235 In order to determine the set of objects which are referenced, search
236 all references for commit objects and tag objects, and traverse the
237 corresponding tree object hierarchies.
238 Any loose object IDs not encountered during this search are unreferenced
239 and thus subject to removal.
240 Display the number of commits which have been searched to indicate progress.
241 .Pp
242 References in the
243 .Pa refs/got
244 namespace may prevent objects from being purged.
245 This includes references in the
246 .Pa refs/got/worktree
247 namespace created by
248 .Cm got checkout
249 and
250 .Cm got update ,
251 as well as references in the
252 .Pa refs/got/backup
253 namespace created by
254 .Cm got rebase
255 and
256 .Cm got histedit .
257 .Cm gotadmin cleanup
258 will only purge corresponding objects once such references have been
259 deleted with
260 .Cm got ref -d .
261 .Pp
262 Some Git repositories contain pack index files which lack a corresponding
263 pack file, which is an inconsistent repository state.
264 In such cases,
265 .Cm gotadmin cleanup -p -n
266 will display a list of affected pack index files.
267 Whenever possible, the missing pack files should be restored.
268 If restoring missing pack files is not possible, then affected pack index
269 files can be removed with
270 .Cm gotadmin cleanup -p .
271 .Pp
272 The
273 .Dq preciousObjects
274 Git extension is intended to prevent the removal of objects from a repository.
275 .Cm gotadmin cleanup
276 will refuse to operate on repositories where this extension is active.
277 .Pp
278 The options for
279 .Cm gotadmin cleanup
280 are as follows:
281 .Bl -tag -width Ds
282 .It Fl a
283 Delete all loose objects.
284 By default, objects which are newer than an implementation-defined
285 modification timestamp are kept on disk to prevent race conditions
286 with other commands that add new objects to the repository while
287 .Cm gotadmin cleanup
288 is running.
289 .It Fl p
290 Instead of purging unreferenced loose objects, remove any pack index files
291 which do not have a corresponding pack file.
292 .It Fl n
293 Display the usual progress output and summary information but do not actually
294 remove any files from disk.
295 .It Fl r Ar repository-path
296 Use the repository at the specified path.
297 If not specified, assume the repository is located at or above the current
298 working directory.
299 If this directory is a
300 .Xr got 1
301 work tree, use the repository path associated with this work tree.
302 .It Fl q
303 Suppress progress reporting and disk space summary output.
304 .El
305 .El
306 .Sh EXIT STATUS
307 .Ex -std gotadmin
308 .Sh SEE ALSO
309 .Xr got 1 ,
310 .Xr tog 1 ,
311 .Xr git-repository 5 ,
312 .Xr got.conf 5
313 .Sh AUTHORS
314 .An Christian Weisgerber Aq Mt naddy@openbsd.org
315 .An Josh Rickmar Aq Mt jrick@zettaport.com
316 .An Klemens Nanni Aq Mt kn@openbsd.org
317 .An Ori Bernstein Aq Mt ori@openbsd.org
318 .An Stefan Sperling Aq Mt stsp@openbsd.org
319 .An Tracey Emery Aq Mt tracey@traceyemery.net
320 .Sh CAVEATS
321 .Nm
322 is a work-in-progress and some features remain to be implemented.
323 .Pp
324 At present, the user has to fall back on
325 .Xr git 1
326 to perform some tasks.
327 In particular:
328 .Bl -bullet
329 .It
330 Removing redundant or unreferenced packed objects requires
331 .Xr git-gc 1
332 and perhaps
333 .Xr git-repack 1 .
334 .It
335 Exporting data from repositories requires
336 .Xr git-fast-export 1 .
337 .It
338 Importing data into repositories requires
339 .Xr git-fast-import 1 .
340 .El
341 .Sh BUGS
342 Disk space savings reported by
343 .Cm gotadmin cleanup
344 will be misleading if the repository contains object files that were
345 hard-linked from another repository.
346 Such hard-links will be created by certain
347 .Xr git 1
348 commands.
349 By itself,
350 .Xr got 1
351 will never create hard-linked object files.