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