From 8286231577ef315e8b982375fcd539b14c264459 Mon Sep 17 00:00:00 2001 From: rsteube Date: Fri, 16 Aug 2024 23:17:43 +0200 Subject: [PATCH] git: pack-objects --- completers/git_completer/cmd/packObjects.go | 66 +++++++++++++++++++ .../cmd/pack_objects_generated.go | 57 ---------------- 2 files changed, 66 insertions(+), 57 deletions(-) create mode 100644 completers/git_completer/cmd/packObjects.go delete mode 100644 completers/git_completer/cmd/pack_objects_generated.go diff --git a/completers/git_completer/cmd/packObjects.go b/completers/git_completer/cmd/packObjects.go new file mode 100644 index 0000000000..ce8c393c55 --- /dev/null +++ b/completers/git_completer/cmd/packObjects.go @@ -0,0 +1,66 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var packObjectsCmd = &cobra.Command{ + Use: "pack-objects", + Short: "Create a packed archive of objects", + Run: func(cmd *cobra.Command, args []string) {}, + GroupID: groups[group_low_level_manipulator].ID, +} + +func init() { + carapace.Gen(packObjectsCmd).Standalone() + + packObjectsCmd.Flags().Bool("all", false, "pretend as if all refs under refs/ are specified to be included") + packObjectsCmd.Flags().Bool("all-progress", false, "progress report is displayed during the object count and compression phases") + packObjectsCmd.Flags().Bool("all-progress-implied", false, "this is used to imply --all-progress whenever progress display is activated") + packObjectsCmd.Flags().String("compression", "", "specifies compression level for newly-compressed data in the generated pack") + packObjectsCmd.Flags().Bool("cruft", false, "packs unreachable objects into a separate \"cruft\" pack") + packObjectsCmd.Flags().String("cruft-expiration", "", "eliminate objects from the cruft pack older than ") + packObjectsCmd.Flags().Bool("delta-base-offset", false, "express the base object of a delta as offset in the stream") + packObjectsCmd.Flags().Bool("delta-islands", false, "restrict delta matches based on \"islands\"") + packObjectsCmd.Flags().String("depth", "", "affect how the objects contained in the pack are stored using delta compression") + packObjectsCmd.Flags().Bool("exclude-promisor-objects", false, "omit objects that are known to be in the promisor remote") + packObjectsCmd.Flags().String("filter", "", "omit certain objects from the resulting packfile") + packObjectsCmd.Flags().Bool("honor-pack-keep", false, "ignore object already in a local pack that has a .keep file,") + packObjectsCmd.Flags().Bool("include-tag", false, "include unasked-for annotated tags if the object they reference was included in the resulting packfile") + packObjectsCmd.Flags().Bool("incremental", false, "ignore object already in a pack") + packObjectsCmd.Flags().String("index-version", "", "force the version for the generated pack index") + packObjectsCmd.Flags().String("keep-pack", "", "ignore object already in given pack") + packObjectsCmd.Flags().Bool("keep-unreachable", false, "objects unreachable from the refs in named packs are added to the resulting pack") + packObjectsCmd.Flags().String("local", "", "object that is borrowed from an alternate object store ") + packObjectsCmd.Flags().String("max-pack-size", "", "split the output packfile into multiple independent packfiles") + packObjectsCmd.Flags().String("missing", "", "specify how missing objects are handled") + packObjectsCmd.Flags().Bool("no-filter", false, "turn off any previous --filter= argument") + packObjectsCmd.Flags().Bool("no-reuse-delta", false, "do not reuse existing deltas") + packObjectsCmd.Flags().Bool("no-reuse-object", false, "do not reuse existing object data at all") + packObjectsCmd.Flags().Bool("no-sparse", false, "disable \"sparse\" algorithm") + packObjectsCmd.Flags().Bool("non-empty", false, "only create a packed archive if it would contain at least one object") + packObjectsCmd.Flags().Bool("pack-loose-unreachable", false, "pack unreachable loose objects") + packObjectsCmd.Flags().Bool("progress", false, "progress status is reported on the standard error stream") + packObjectsCmd.Flags().BoolS("q", "q", false, "do not to report progress on the standard error stream") + packObjectsCmd.Flags().Bool("revs", false, "read the revision arguments from the standard input") + packObjectsCmd.Flags().Bool("shallow", false, "optimize a pack that will be provided to a client with a shallow repository") + packObjectsCmd.Flags().Bool("sparse", false, "enable \"sparse\" algorithm") + packObjectsCmd.Flags().Bool("stdin-packs", false, "read the basenames of packfiles from the standard input") + packObjectsCmd.Flags().Bool("stdout", false, "write the pack contents out to the standard output") + packObjectsCmd.Flags().Bool("thin", false, "create a \"thin\" pack by omitting the common objects between a sender and a receiver") + packObjectsCmd.Flags().String("threads", "", "number of threads to spawn when searching for best delta matches") + packObjectsCmd.Flags().Bool("unpack-unreachable", false, "keep unreachable objects in loose form") + packObjectsCmd.Flags().Bool("unpacked", false, "limit the objects packed to those that are not already packed") + packObjectsCmd.Flags().String("window", "", "affect how the objects contained in the pack are stored using delta compression") + packObjectsCmd.Flags().String("window-memory", "", "additional limit on top of --window") + rootCmd.AddCommand(packObjectsCmd) + + carapace.Gen(packObjectsCmd).FlagCompletion(carapace.ActionMap{ + "missing": carapace.ActionValuesDescribed( + "error", "stop with an error if a missing object is encountered", + "allow-any", "allow object traversal to continue if a missing object is encountered", + "allow-promisor", "only allow object traversal to continue for EXPECTED promisor missing objects", + ), + }) +} diff --git a/completers/git_completer/cmd/pack_objects_generated.go b/completers/git_completer/cmd/pack_objects_generated.go deleted file mode 100644 index be1e5cea5d..0000000000 --- a/completers/git_completer/cmd/pack_objects_generated.go +++ /dev/null @@ -1,57 +0,0 @@ -package cmd - -import ( - "github.com/carapace-sh/carapace" - "github.com/spf13/cobra" -) - -var pack_objectsCmd = &cobra.Command{ - Use: "pack-objects", - Short: "Create a packed archive of objects", - Run: func(cmd *cobra.Command, args []string) {}, - GroupID: groups[group_low_level_manipulator].ID, -} - -func init() { - carapace.Gen(pack_objectsCmd).Standalone() - pack_objectsCmd.Flags().Bool("all", false, "include objects reachable from any reference") - pack_objectsCmd.Flags().Bool("all-progress", false, "show progress meter during object writing phase") - pack_objectsCmd.Flags().Bool("all-progress-implied", false, "similar to --all-progress when progress meter is shown") - pack_objectsCmd.Flags().String("compression", "", "pack compression level") - pack_objectsCmd.Flags().Bool("delta-base-offset", false, "use OFS_DELTA objects") - pack_objectsCmd.Flags().Bool("delta-islands", false, "respect islands during delta compression") - pack_objectsCmd.Flags().String("depth", "", "maximum length of delta chain allowed in the resulting pack") - pack_objectsCmd.Flags().Bool("exclude-promisor-objects", false, "do not pack objects in promisor packfiles") - pack_objectsCmd.Flags().String("filter", "", "object filtering") - pack_objectsCmd.Flags().Bool("honor-pack-keep", false, "ignore packs that have companion .keep file") - pack_objectsCmd.Flags().Bool("include-tag", false, "include tag objects that refer to objects to be packed") - pack_objectsCmd.Flags().Bool("incremental", false, "ignore packed objects") - pack_objectsCmd.Flags().String("index-version", "", "write the pack index file in the specified idx format version") - pack_objectsCmd.Flags().Bool("indexed-objects", false, "include objects referred to by the index") - pack_objectsCmd.Flags().String("keep-pack", "", "ignore this pack") - pack_objectsCmd.Flags().Bool("keep-true-parents", false, "do not hide commits by grafts") - pack_objectsCmd.Flags().Bool("keep-unreachable", false, "keep unreachable objects") - pack_objectsCmd.Flags().Bool("local", false, "ignore borrowed objects from alternate object store") - pack_objectsCmd.Flags().String("max-pack-size", "", "maximum size of each output pack file") - pack_objectsCmd.Flags().String("missing", "", "handling for missing objects") - pack_objectsCmd.Flags().Bool("non-empty", false, "do not create an empty pack output") - pack_objectsCmd.Flags().Bool("pack-loose-unreachable", false, "pack loose unreachable objects") - pack_objectsCmd.Flags().Bool("progress", false, "show progress meter") - pack_objectsCmd.Flags().BoolP("quiet", "q", false, "do not show progress meter") - pack_objectsCmd.Flags().Bool("reflog", false, "include objects referred by reflog entries") - pack_objectsCmd.Flags().Bool("reuse-delta", false, "reuse existing deltas") - pack_objectsCmd.Flags().Bool("reuse-object", false, "reuse existing objects") - pack_objectsCmd.Flags().Bool("revs", false, "read revision arguments from standard input") - pack_objectsCmd.Flags().Bool("shallow", false, "create packs suitable for shallow fetches") - pack_objectsCmd.Flags().Bool("sparse", false, "use the sparse reachability algorithm") - pack_objectsCmd.Flags().Bool("stdout", false, "output pack to stdout") - pack_objectsCmd.Flags().Bool("thin", false, "create thin packs") - pack_objectsCmd.Flags().String("threads", "", "use threads when searching for best delta matches") - pack_objectsCmd.Flags().String("unpack-unreachable", "", "unpack unreachable objects newer than