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 .Op Fl hV
25 .Ar command
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 Oo Fl b Ar branch Oc 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 new repository must be populated before
63 .Cm got checkout
64 can be used.
65 The
66 .Cm got import
67 command can be used to populate the new repository with data from
68 a local directory.
69 Alternatively, on a server running
70 .Xr gotd 8 ,
71 the new repository can be made available to
72 .Xr got 1
73 or
74 .Xr git 1
75 clients by adding the repository to
76 .Xr gotd.conf 5
77 and restarting
78 .Xr gotd 8 .
79 Clients may then clone the new repository from the server, populate the cloned
80 repository, and then populate the new repository on the server via
81 .Cm got send
82 or
83 .Cm git push .
84 .Pp
85 The options for
86 .Cm gotadmin init
87 are as follows:
88 .Bl -tag -width Ds
89 .It Fl b Ar branch
90 Make the repository's HEAD reference point to the specified
91 .Ar branch
92 instead of the default branch
93 .Dq main .
94 .El
95 .Pp
96 The
97 .Cm gotadmin init
98 command is equivalent to
99 .Cm got init .
100 .It Cm info Op Fl r Ar repository-path
101 Display information about a repository.
102 This includes some configuration settings from
103 .Xr got.conf 5 ,
104 and the number of objects stored in the repository, in packed or
105 loose form, as well as the current on-disk size of these objects.
106 .Pp
107 The options for
108 .Cm gotadmin info
109 are as follows:
110 .Bl -tag -width Ds
111 .It Fl r Ar repository-path
112 Use the repository at the specified path.
113 If not specified, assume the repository is located at or above the current
114 working directory.
115 If this directory is a
116 .Xr got 1
117 work tree, use the repository path associated with this work tree.
118 .El
119 .It Xo
120 .Cm pack
121 .Op Fl aDq
122 .Op Fl r Ar repository-path
123 .Op Fl x Ar reference
124 .Op Ar reference ...
125 .Xc
126 Generate a new pack file and a corresponding pack file index.
127 By default, add any loose objects which are reachable via any references
128 to the generated pack file.
129 .Pp
130 If one or more
131 .Ar reference
132 arguments is specified, only add objects which are reachable via the specified
133 references.
134 Each
135 .Ar reference
136 argument may either specify a specific reference or a reference namespace,
137 in which case all references within this namespace will be used.
138 .Pp
139 .Cm gotadmin pack
140 always ignores references in the
141 .Pa refs/got/
142 namespace, effectively treating such references as if they did not refer
143 to any objects.
144 .Pp
145 The options for
146 .Cm gotadmin pack
147 are as follows:
148 .Bl -tag -width Ds
149 .It Fl a
150 Add objects to the generated pack file even if they are already packed
151 in a different pack file.
152 Unless this option is specified, only loose objects will be added.
153 .It Fl D
154 Force the use of ref-delta representation for deltified objects.
155 If this option is not specified, offset-deltas will be used to represent
156 deltified objects.
157 .It Fl q
158 Suppress progress reporting output.
159 .It Fl r Ar repository-path
160 Use the repository at the specified path.
161 If not specified, assume the repository is located at or above the current
162 working directory.
163 If this directory is a
164 .Xr got 1
165 work tree, use the repository path associated with this work tree.
166 .It Fl x Ar reference
167 Exclude objects reachable via the specified
168 .Ar reference
169 from the pack file.
170 The
171 .Ar reference
172 argument may either specify a specific reference or a reference namespace,
173 in which case all references within this namespace will be excluded.
174 The
175 .Fl x
176 option may be specified multiple times to build a list of references to exclude.
177 .Pp
178 Exclusion takes precedence over inclusion.
179 If a reference appears in both the included and excluded lists, it will
180 be excluded.
181 .El
182 .Tg ix
183 .It Cm indexpack Ar packfile-path
184 .Dl Pq alias: Cm ix
185 Create a pack index for the pack file at
186 .Ar packfile-path .
187 .Pp
188 A pack index is required for using the corresponding pack file with
189 .Xr got 1 .
190 Usually, a pack index will be created by commands such as
191 .Cm gotadmin pack
192 or
193 .Cm got fetch
194 as part of regular operation.
195 The
196 .Cm gotadmin indexpack
197 command may be used to recover from a corrupt or missing index.
198 A given pack file will always yield the same bit-identical index.
199 .Pp
200 The provided
201 .Ar packfile-path
202 must be located within the
203 .Pa objects/pack/
204 directory of the repository and should end in
205 .Pa .pack .
206 The filename of the corresponding pack index is equivalent, except
207 that it ends in
208 .Pa .idx .
209 .Tg ls
210 .It Xo
211 .Cm listpack
212 .Op Fl hs
213 .Ar packfile-path
214 .Xc
215 .Dl Pq alias: Cm ls
216 List the contents of the pack file at
217 .Ar packfile-path .
218 .Pp
219 Each object contained in the pack file will be displayed on a single line.
220 The information shown includes the object ID, object type, object offset,
221 and object size.
222 .Pp
223 If a packed object is deltified against another object, the delta base
224 will be shown as well.
225 For offset deltas, the delta base is identified via an offset into the
226 pack file.
227 For reference deltas, the delta base is identified via an object ID.
228 .Pp
229 The provided
230 .Ar packfile-path
231 must be located within the
232 .Pa objects/pack/
233 directory of the repository and should end in
234 .Pa .pack .
235 The corresponding pack index must exist and can be created with
236 .Cm gotadmin indexpack
237 if it is missing.
238 .Pp
239 The options for
240 .Cm gotadmin listpack
241 are as follows:
242 .Bl -tag -width Ds
243 .It Fl h
244 Show object sizes in human-readable form.
245 .It Fl s
246 Display statistics about the pack file after listing objects.
247 This includes the total number of objects stored in the pack file
248 and a break-down of the number of objects per object type.
249 .El
250 .Tg cl
251 .It Xo
252 .Cm cleanup
253 .Op Fl anpq
254 .Op Fl r Ar repository-path
255 .Xc
256 .Dl Pq alias: Cm cl
257 Purge unreferenced loose objects and redundant pack files from the
258 repository and display the amount of disk space which has been freed
259 as a result.
260 .Pp
261 Unreferenced objects are present in the repository but cannot be
262 reached via any reference in the entire
263 .Pa refs/
264 namespace.
265 Objects will usually become unreferenced as a result of deleting
266 branches, tags, or other references with
267 .Cm got branch -d ,
268 .Cm got ref -d ,
269 or
270 .Cm got fetch -X .
271 .Pp
272 Loose objects are stored as individual files beneath the repository's
273 .Pa objects/
274 directory,
275 spread across 256 sub-directories named after the 256 possible
276 hexadecimal values of the first byte of an object identifier.
277 .Pp
278 Packed objects are stored in pack files under
279 .Pa objects/pack/ .
280 .Pp
281 If redundant copies of packed objects exist in loose form, such
282 redundant copies will be purged.
283 If all the objects of a pack file are present in other pack files,
284 the redundant pack file will be purged.
285 Pack files will usually become redundant as a result of repacking the
286 repository with
287 .Nm
288 .Cm pack Fl a .
289 .Pp
290 References in the
291 .Pa refs/got
292 namespace may prevent objects from being purged.
293 This includes references in the
294 .Pa refs/got/worktree
295 namespace created by
296 .Cm got checkout
297 and
298 .Cm got update ,
299 as well as references in the
300 .Pa refs/got/backup
301 namespace created by
302 .Cm got rebase
303 and
304 .Cm got histedit .
305 .Cm gotadmin cleanup
306 will only purge corresponding objects once such references have been
307 deleted with
308 .Cm got rebase -X ,
309 .Cm got histedit -X ,
310 or
311 .Cm got ref -d .
312 .Pp
313 The
314 .Dq preciousObjects
315 Git extension is intended to prevent the removal of objects from a repository.
316 .Cm gotadmin cleanup
317 will refuse to operate on repositories where this extension is active.
318 .Pp
319 For compatibility with Git, if a file with the extension
320 .Pa .keep
321 exists and corresponds to a pack file with the extension
322 .Pa .pack
323 then this pack file will not be removed.
324 .Pp
325 Some Git repositories contain pack index files which lack a corresponding
326 pack file, which is an inconsistent repository state.
327 In such cases,
328 .Cm gotadmin cleanup -p -n
329 will display a list of affected pack index files.
330 Whenever possible, the missing pack files should be restored.
331 If restoring missing pack files is not possible, then affected pack index
332 files can be removed with
333 .Cm gotadmin cleanup -p .
334 .Pp
335 The options for
336 .Cm gotadmin cleanup
337 are as follows:
338 .Bl -tag -width Ds
339 .It Fl a
340 Delete all redundant loose and packed objects.
341 By default, objects which are newer than an implementation-defined
342 modification timestamp are kept on disk to prevent race conditions
343 with other commands that add new objects to the repository while
344 .Cm gotadmin cleanup
345 is running.
346 .It Fl n
347 Display the usual progress output and summary information but do not actually
348 remove any files from disk.
349 .It Fl p
350 Instead of purging unreferenced loose objects and redundant pack files,
351 remove any pack index files which do not have a corresponding pack file.
352 .It Fl q
353 Suppress progress reporting and disk space summary output.
354 .It Fl r Ar repository-path
355 Use the repository at the specified path.
356 If not specified, assume the repository is located at or above the current
357 working directory.
358 If this directory is a
359 .Xr got 1
360 work tree, use the repository path associated with this work tree.
361 .El
362 .It Xo
363 .Cm dump
364 .Op Fl q
365 .Op Fl r Ar repository-path
366 .Op Fl x Ar reference
367 .Op Ar reference ...
368 .Xc
369 Dump the contents of the repository to standard output in Git bundle format.
370 .Pp
371 If one or more
372 .Ar reference
373 arguments is specified, only add objects which are reachable via the specified
374 references.
375 Each
376 .Ar reference
377 argument may either specify a specific reference or a reference namespace,
378 in which case all references within this namespace will be used.
379 .Pp
380 The options for
381 .Nm
382 .Cm dump
383 are as follows:
384 .Bl -tag -width Ds
385 .It Fl q
386 Suppress progress reporting output.
387 .It Fl r Ar repository-path
388 Use the repository at the specified path.
389 If not specified, assume the repository is located at or above the current
390 working directory.
391 If this directory is a
392 .Xr got 1
393 work tree, use the repository path associated with this work tree.
394 .It Fl x Ar reference
395 Exclude objects reachable via the specified
396 .Ar reference
397 from the bundle.
398 The
399 .Ar reference
400 argument may either specify a specific reference or a reference namespace,
401 in which case all references within this namespace will be excluded.
402 The
403 .Fl x
404 option may be specified multiple times to build a list of references to exclude.
405 .Pp
406 Exclusion takes precedence over inclusion.
407 If a reference appears in both the included and excluded lists, it will
408 be excluded.
409 .El
410 .It Xo
411 .Cm load
412 .Op Fl nq
413 .Op Fl l Ar bundle-path
414 .Op Fl r Ar repository-path
415 .Op Ar reference ...
416 .Xc
417 Read a Git bundle stream from standard input and load its data into
418 a repository.
419 .Pp
420 If one or more
421 .Ar reference
422 arguments are provided then only load the specified references
423 from the bundle.
424 Otherwise, all references will be loaded.
425 .Pp
426 The options for
427 .Cm gotadmin load
428 are as follows:
429 .Bl -tag -width Ds
430 .It Fl l Ar bundle-path
431 List references available for loading from the bundle at the specified
432 .Ar bundle-path
433 and exit immediately.
434 If the
435 .Fl l
436 option is specified then no
437 .Ar reference
438 arguments are allowed.
439 The
440 .Fl l
441 option is incompatible with the
442 .Fl n
443 option.
444 .It Fl n
445 Attempt to load the bundle but don't install new packfile or update any
446 reference.
447 Can be used to verify the integrity of the bundle.
448 .It Fl q
449 Suppress progress reporting output.
450 .It Fl r Ar repository-path
451 Use the repository at the specified path.
452 If not specified, assume the repository is located at or above the
453 current working directory.
454 If this directory is a
455 .Xr got 1
456 work tree, use the repository path associated with this work tree.
457 .El
458 .El
459 .Sh EXIT STATUS
460 .Ex -std gotadmin
461 .Sh SEE ALSO
462 .Xr got 1 ,
463 .Xr tog 1 ,
464 .Xr git-repository 5 ,
465 .Xr got.conf 5
466 .Sh AUTHORS
467 .An Christian Weisgerber Aq Mt naddy@openbsd.org
468 .An Josh Rickmar Aq Mt jrick@zettaport.com
469 .An Klemens Nanni Aq Mt kn@openbsd.org
470 .An Omar Polo Aq Mt op@openbsd.org
471 .An Ori Bernstein Aq Mt ori@openbsd.org
472 .An Stefan Sperling Aq Mt stsp@openbsd.org
473 .An Tracey Emery Aq Mt tracey@traceyemery.net
474 .Sh CAVEATS
475 .Nm
476 is a work-in-progress and some features remain to be implemented.
477 .Pp
478 At present, the user has to fall back on
479 .Xr git 1
480 to perform some tasks.
481 In particular:
482 .Bl -bullet
483 .It
484 Exporting data from repositories requires
485 .Xr git-fast-export 1 .
486 .It
487 Importing data into repositories requires
488 .Xr git-fast-import 1 .
489 .El
490 .Sh BUGS
491 Disk space savings reported by
492 .Cm gotadmin cleanup
493 will be misleading if the repository contains object files that were
494 hard-linked from another repository.
495 Such hard-links will be created by certain
496 .Xr git 1
497 commands.
498 By itself,
499 .Xr got 1
500 will never create hard-linked object files.