Download raw body.
introducing gotadmin dump
Omar Polo <op@omarpolo.com> wrote: > here's a first attempt at teaching gotadmin to generate bundles. Git > bundles are packfiles with a text header to allow git to clone or pull > from. They're useful as a mean to beckup or offline transfer (part > of) the history. > > The plan would be to extend it to generate a plain-text version of the > history (a fast-export stream) too, and add an symmetric command > `load' to, well, load the bundle or fast-import stream in the > repository. > > (that's also why i'm adding a new file dump.c, it will grow functions > to generate a fast-export stream.) > > as noted in the other thread, I'm not sure how to handle the progress, > but didn't want to stress this yet, so i'm just reusing the pack > progress callback. I'll have to revisit it soon(tm) to handle the > fast-export stream format, and didn't want to add a wrapper callback > just for the sake of having a different name. > I don't have a lot of time right now but wanted to sneak a peek at the interface--I like this! A tiny suggestion in the help text is all I have to say at the moment but I will revisit to review and test the code this evening. > ----------------------------------------------- > commit e528344ca7439b5a2401f3c132c91eb6046e6784 (fe) > from: Omar Polo <op@omarpolo.com> > date: Thu Jul 6 14:27:22 2023 UTC > > add an initial implementation of gotadmin dump > > gotadmin dump is used to export (part of) the history of the > repository; at the moment it only generates git bundles (which are > pack files with a header) but support to generate a fast-import > stream is planned. > > diff 27555e8e6053ab0cc846d201757b588d5a79293f e528344ca7439b5a2401f3c132c91eb6046e6784 > commit - 27555e8e6053ab0cc846d201757b588d5a79293f > commit + e528344ca7439b5a2401f3c132c91eb6046e6784 > blob - 6e194139586ae1731a9aef3771d60596d3d0c756 > blob + 80e118616d09947850bdc2b12829cac8eb2c8b3f > --- gotadmin/Makefile > +++ gotadmin/Makefile > @@ -11,7 +11,8 @@ SRCS= gotadmin.c \ > worktree_open.c hash.c bloom.c murmurhash2.c ratelimit.c \ > sigs.c buf.c date.c object_open_privsep.c \ > read_gitconfig_privsep.c read_gotconfig_privsep.c \ > - pack_create_privsep.c pollfd.c reference_parse.c object_qid.c > + pack_create_privsep.c pollfd.c reference_parse.c object_qid.c \ > + dump.c > MAN = ${PROG}.1 > > CPPFLAGS = -I${.CURDIR}/../include -I${.CURDIR}/../lib > blob - 8be42abe6d6ca03b938b1aebc0e2200cf5ffbf9f > blob + 82bdcfb3e951cfff17a4fcf32279e0ce6ca40880 > --- gotadmin/gotadmin.1 > +++ gotadmin/gotadmin.1 > @@ -337,7 +337,55 @@ work tree, use the repository path associated with thi > .Xr got 1 > work tree, use the repository path associated with this work tree. > .El > +.It Xo > +.Cm dump > +.Op Fl q > +.Op Fl r Ar repository-path > +.Op Fl x Ar reference > +.Op Ar reference ... > +.Xc > +Dump the contents of the repository to standard output. > +.Pp > +If one or more > +.Ar reference > +argumenst is specified, only add objects which are reachable via the specified s/argumenst/arguments > +references. > +Each > +.Ar reference > +argument may either specify a specific reference or a reference namespace, I think the 'specific' adjective is a bit of a tautology with the 'specify' verb so would remove it: argument may either specify a reference or a reference namespace, > +in which case all references within this namespace will be used. > +.Pp > +The options for > +.Nm > +.Cm dump > +are as follows: > +.Bl -tag -width Ds > +.It Fl q > +Suppress progress reporting output. > +.It Fl r Ar repository-path > +Use the repository at the specified path. > +If not specified, assume the repository is located at or above the current > +working directory. > +If this directory is a > +.Xr got 1 > +work tree, use the repository path associated with this work tree. > +.It Fl x Ar reference > +Exclude objects reachable via the specified > +.Ar reference > +from the dump file. > +The > +.Ar reference > +argument may either specify a specific reference or a reference namespace, as above: s/specific ref/ref > +in which case all references within this namespace will be excluded. > +The > +.Fl x > +option may be specified multiple times to build a list of references to exclude. > +.Pp > +Exclusion takes precedence over inclusion. > +If a reference appears in both the included and excluded lists, it will > +be excluded. > .El > +.El > .Sh EXIT STATUS > .Ex -std gotadmin > .Sh SEE ALSO -- Mark Jamsek <https://bsdbox.org> GPG: F2FF 13DE 6A06 C471 CA80 E6E2 2930 DC66 86EE CF68
introducing gotadmin dump