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 info Oo Fl r Ar repository-path Oc
57 Display information about a repository.
58 This includes some configuration settings from
59 .Xr got.conf 5 ,
60 and the number of objects stored in the repository, in packed or
61 loose form, as well as the current on-disk size of these objects.
62 .Pp
63 The options for
64 .Cm gotadmin info
65 are as follows:
66 .Bl -tag -width Ds
67 .It Fl r Ar repository-path
68 Use the repository at the specified path.
69 If not specified, assume the repository is located at or above the current
70 working directory.
71 If this directory is a
72 .Xr got 1
73 work tree, use the repository path associated with this work tree.
74 .El
75 .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 ...
76 Generate a new pack file and a corresponding pack file index.
77 By default, add any loose objects which are reachable via any references
78 to the generated pack file.
79 .Pp
80 If one or more
81 .Ar reference
82 arguments is specified, only add objects which are reachable via the specified
83 references.
84 Each
85 .Ar reference
86 argument may either specify a specific reference or a reference namespace,
87 in which case all references within this namespace will be used.
88 .Pp
89 .Cm gotadmin pack
90 always ignores references in the
91 .Pa refs/got/
92 namespace, effectively treating such references as if they did not refer
93 to any objects.
94 .Pp
95 The options for
96 .Cm gotadmin pack
97 are as follows:
98 .Bl -tag -width Ds
99 .It Fl a
100 Add objects to the generated pack file even if they are already packed
101 in a different pack file.
102 Unless this option is specified, only loose objects will be added.
103 .It Fl r Ar repository-path
104 Use the repository at the specified path.
105 If not specified, assume the repository is located at or above the current
106 working directory.
107 If this directory is a
108 .Xr got 1
109 work tree, use the repository path associated with this work tree.
110 .It Fl x Ar reference
111 Exclude objects reachable via the specified
112 .Ar reference
113 from the pack file.
114 The
115 .Ar reference
116 argument may either specify a specific reference or a reference namespace,
117 in which case all references within this namespace will be excluded.
118 The
119 .Fl x
120 option may be specified multiple times to build a list of references to exclude.
121 .Pp
122 Exclusion takes precedence over inclusion.
123 If a reference appears in both the included and excluded lists, it will
124 be excluded.
125 .It Fl q
126 Suppress progress reporting output.
127 .El
128 .Tg ix
129 .It Cm indexpack Ar packfile-path
130 .Dl Pq alias: Cm ix
131 Create a pack index for the pack file at
132 .Ar packfile-path .
133 .Pp
134 A pack index is required for using the corresponding pack file with
135 .Xr got 1 .
136 Usually, a pack index will be created by commands such as
137 .Cm gotadmin pack
138 or
139 .Cm got fetch
140 as part of regular operation.
141 The
142 .Cm gotadmin indexpack
143 command may be used to recover from a corrupt or missing index.
144 A given pack file will always yield the same bit-identical index.
145 .Pp
146 The provided
147 .Ar packfile-path
148 must be located within the
149 .Pa objects/pack/
150 directory of the repository and should end in
151 .Pa .pack .
152 The filename of the corresponding pack index is equivalent, except
153 that it ends in
154 .Pa .idx .
155 .Tg ls
156 .It Cm listpack Oo Fl h Oc Oo Fl s Oc Ar packfile-path
157 .Dl Pq alias: Cm ls
158 List the contents of the pack file at
159 .Ar packfile-path .
160 .Pp
161 Each object contained in the pack file will be displayed on a single line.
162 The information shown includes the object ID, object type, object offset,
163 and object size.
164 .Pp
165 If a packed object is deltified against another object, the delta base
166 will be shown as well.
167 For offset deltas, the delta base is identified via an offset into the
168 pack file.
169 For reference deltas, the delta base is identified via an object ID.
170 .Pp
171 The provided
172 .Ar packfile-path
173 must be located within the
174 .Pa objects/pack/
175 directory of the repository and should end in
176 .Pa .pack .
177 The corresponding pack index must exist and can be created with
178 .Cm gotadmin indexpack
179 if it is missing.
180 .Pp
181 The options for
182 .Cm gotadmin listpack
183 are as follows:
184 .Bl -tag -width Ds
185 .It Fl h
186 Show object sizes in human-readable form.
187 .It Fl s
188 Display statistics about the pack file after listing objects.
189 This includes the total number of objects stored in the pack file
190 and a break-down of the number of objects per object type.
191 .El
192 .Tg cl
193 .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
194 .Dl Pq alias: Cm cl
195 Purge unreferenced loose objects from the repository and display
196 the amount of disk space which has been freed as a result.
197 .Pp
198 Unreferenced objects are present in the repository but cannot be
199 reached via any reference in the entire
200 .Pa refs/
201 namespace.
202 .Pp
203 Loose objects are stored as individual files beneath the repository's
204 .Pa objects/
205 directory,
206 spread across 256 sub-directories named after the 256 possible
207 hexadecimal values of the first byte of an object identifier.
208 .Pp
209 Packed objects stored in pack files under
210 .Pa objects/pack/
211 will not be purged.
212 However, if redundant copies of packed objects exist in loose form,
213 such redundant copies will be purged.
214 .Pp
215 Objects will usually become unreferenced as a result of deleting
216 branches or tags with
217 .Cm got branch -d
218 or
219 .Cm got tag -d .
220 Deleting arbitrary references with
221 .Cm got ref -d
222 may also leave unreferenced objects behind.
223 .Pp
224 In order to determine the set of objects which are referenced, search
225 all references for commit objects and tag objects, and traverse the
226 corresponding tree object hierarchies.
227 Any loose object IDs not encountered during this search are unreferenced
228 and thus subject to removal.
229 Display the number of commits which have been searched to indicate progress.
230 .Pp
231 References in the
232 .Pa refs/got
233 namespace may prevent objects from being purged.
234 This includes references in the
235 .Pa refs/got/worktree
236 namespace created by
237 .Cm got checkout
238 and
239 .Cm got update ,
240 as well as references in the
241 .Pa refs/got/backup
242 namespace created by
243 .Cm got rebase
244 and
245 .Cm got histedit .
246 .Cm gotadmin cleanup
247 will only purge corresponding objects once such references have been
248 deleted with
249 .Cm got ref -d .
250 .Pp
251 Some Git repositories contain pack index files which lack a corresponding
252 pack file, which is an inconsistent repository state.
253 In such cases,
254 .Cm gotadmin cleanup -p -n
255 will display a list of affected pack index files.
256 Whenever possible, the missing pack files should be restored.
257 If restoring missing pack files is not possible, then affected pack index
258 files can be removed with
259 .Cm gotadmin cleanup -p .
260 .Pp
261 The
262 .Dq preciousObjects
263 Git extension is intended to prevent the removal of objects from a repository.
264 .Cm gotadmin cleanup
265 will refuse to operate on repositories where this extension is active.
266 .Pp
267 The options for
268 .Cm gotadmin cleanup
269 are as follows:
270 .Bl -tag -width Ds
271 .It Fl a
272 Delete all loose objects.
273 By default, objects which are newer than an implementation-defined
274 modification timestamp are kept on disk to prevent race conditions
275 with other commands that add new objects to the repository while
276 .Cm gotadmin cleanup
277 is running.
278 .It Fl p
279 Instead of purging unreferenced loose objects, remove any pack index files
280 which do not have a corresponding pack file.
281 .It Fl n
282 Display the usual progress output and summary information but do not actually
283 remove any files from disk.
284 .It Fl r Ar repository-path
285 Use the repository at the specified path.
286 If not specified, assume the repository is located at or above the current
287 working directory.
288 If this directory is a
289 .Xr got 1
290 work tree, use the repository path associated with this work tree.
291 .It Fl q
292 Suppress progress reporting and disk space summary output.
293 .El
294 .El
295 .Sh EXIT STATUS
296 .Ex -std gotadmin
297 .Sh SEE ALSO
298 .Xr got 1 ,
299 .Xr tog 1 ,
300 .Xr git-repository 5 ,
301 .Xr got.conf 5
302 .Sh AUTHORS
303 .An Stefan Sperling Aq Mt stsp@openbsd.org
304 .An Ori Bernstein Aq Mt ori@openbsd.org
305 .Sh CAVEATS
306 .Nm
307 is a work-in-progress and some features remain to be implemented.
308 .Pp
309 At present, the user has to fall back on
310 .Xr git 1
311 to perform some tasks.
312 In particular:
313 .Bl -bullet
314 .It
315 Removing redundant or unreferenced packed objects requires
316 .Xr git-gc 1
317 and perhaps
318 .Xr git-repack 1 .
319 .It
320 Exporting data from repositories requires
321 .Xr git-fast-export 1 .
322 .It
323 Importing data into repositories requires
324 .Xr git-fast-import 1 .
325 .El
326 .Sh BUGS
327 Disk space savings reported by
328 .Cm gotadmin cleanup
329 will be misleading if the repository contains object files that were
330 hard-linked from another repository.
331 Such hard-links will be created by certain
332 .Xr git 1
333 commands.
334 By itself,
335 .Xr got 1
336 will never create hard-linked object files.