| @@ -51,9 +51,6 @@ pub struct Args { · 50 unmodified lines |
| 51 | 51 | |
| 52 | 52 | #[derive(Debug, clap::Subcommand)] |
| 53 | 53 | pub enum Subcommands { |
| 54 | | − /// Subcommands for interacting with packs and their indices. |
| 55 | | − #[clap(subcommand)] |
| 56 | | − Pack(pack::Subcommands), |
| 57 | 54 | /// Subcommands for interacting with git remote server. |
| 58 | 55 | #[clap(subcommand)] |
| 59 | 56 | #[cfg(any(feature = "gitoxide-core-async-client", feature = "gitoxide-core-blocking-client"))] |
| @@ -71,277 +68,280 @@ pub enum Subcommands { · 11 unmodified lines |
| 71 | 68 | } |
| 72 | 69 | |
| 73 | 70 | /// |
| 74 | | −pub mod pack { |
| 75 | | − use std::{ffi::OsString, path::PathBuf}; |
| 76 | | − |
| 77 | | − use gitoxide_core as core; |
| 78 | | − |
| 71 | +pub mod free { |
| 79 | 72 | #[derive(Debug, clap::Subcommand)] |
| 80 | 73 | pub enum Subcommands { |
| 81 | | − /// Subcommands for interacting with pack indices (.idx) |
| 74 | + /// Subcommands for interacting with mailmaps |
| 75 | + Mailmap { |
| 76 | + #[clap(flatten)] |
| 77 | + cmd: mailmap::Platform, |
| 78 | + }, |
| 79 | + /// Subcommands for interacting with pack files and indices |
| 82 | 80 | #[clap(subcommand)] |
| 83 | | − Index(index::Subcommands), |
| 84 | | − /// Subcommands for interacting with multi-pack indices (named "multi-pack-index") |
| 85 | | − MultiIndex(multi_index::Platform), |
| 86 | | − /// Create a new pack with a set of objects. |
| 87 | | − Create { |
| 88 | | − #[clap(long, short = 'r')] |
| 89 | | − /// the directory containing the '.git' repository from which objects should be read. |
| 90 | | − repository: Option<PathBuf>, |
| 81 | + Pack(pack::Subcommands), |
| 82 | + } |
| 91 | 83 | |
| 92 | | − #[clap(long, short = 'e', possible_values(core::pack::create::ObjectExpansion::variants()))] |
| 93 | | − /// the way objects are expanded. They differ in costs. |
| 94 | | − /// |
| 95 | | − /// Possible values are "none" and "tree-traversal". Default is "none". |
| 96 | | − expansion: Option<core::pack::create::ObjectExpansion>, |
| 84 | + /// |
| 85 | + pub mod pack { |
| 86 | + use std::{ffi::OsString, path::PathBuf}; |
| 97 | 87 | |
| 98 | | − #[clap(long, default_value_t = 3, requires = "nondeterministic-count")] |
| 99 | | − /// The amount of threads to use when counting and the `--nondeterminisitc-count` flag is set, defaulting |
| 100 | | − /// to the globally configured threads. |
| 101 | | − /// |
| 102 | | − /// Use it to have different trade-offs between counting performance and cost in terms of CPU, as the scaling |
| 103 | | − /// here is everything but linear. The effectiveness of each core seems to be no more than 30%. |
| 104 | | − counting_threads: usize, |
| 88 | + use gitoxide_core as core; |
| 105 | 89 | |
| 106 | | − #[clap(long)] |
| 107 | | − /// if set, the counting phase may be accelerated using multithreading. |
| 108 | | − /// |
| 109 | | − /// On the flip side, however, one will loose deterministic counting results which affects the |
| 110 | | − /// way the resulting pack is structured. |
| 111 | | − nondeterministic_count: bool, |
| 90 | + #[derive(Debug, clap::Subcommand)] |
| 91 | + pub enum Subcommands { |
| 92 | + /// Subcommands for interacting with pack indices (.idx) |
| 93 | + #[clap(subcommand)] |
| 94 | + Index(index::Subcommands), |
| 95 | + /// Subcommands for interacting with multi-pack indices (named "multi-pack-index") |
| 96 | + MultiIndex(multi_index::Platform), |
| 97 | + /// Create a new pack with a set of objects. |
| 98 | + Create { |
| 99 | + #[clap(long, short = 'r')] |
| 100 | + /// the directory containing the '.git' repository from which objects should be read. |
| 101 | + repository: Option<PathBuf>, |
| 112 | 102 | |
| 113 | | − #[clap(long, short = 's')] |
| 114 | | − /// If set statistical information will be presented to inform about pack creation details. |
| 115 | | − /// It's a form of instrumentation for developers to help improve pack generation. |
| 116 | | − statistics: bool, |
| 103 | + #[clap(long, short = 'e', possible_values(core::pack::create::ObjectExpansion::variants()))] |
| 104 | + /// the way objects are expanded. They differ in costs. |
| 105 | + /// |
| 106 | + /// Possible values are "none" and "tree-traversal". Default is "none". |
| 107 | + expansion: Option<core::pack::create::ObjectExpansion>, |
| 117 | 108 | |
| 118 | | − #[clap(long)] |
| 119 | | − /// The size in megabytes for a cache to speed up pack access for packs with long delta chains. |
| 120 | | − /// It is shared among all threads, so 4 threads would use their own cache 1/4th of the size. |
| 121 | | − /// |
| 122 | | − /// If unset, no cache will be used. |
| 123 | | − pack_cache_size_mb: Option<usize>, |
| 109 | + #[clap(long, default_value_t = 3, requires = "nondeterministic-count")] |
| 110 | + /// The amount of threads to use when counting and the `--nondeterminisitc-count` flag is set, defaulting |
| 111 | + /// to the globally configured threads. |
| 112 | + /// |
| 113 | + /// Use it to have different trade-offs between counting performance and cost in terms of CPU, as the scaling |
| 114 | + /// here is everything but linear. The effectiveness of each core seems to be no more than 30%. |
| 115 | + counting_threads: usize, |
| 124 | 116 | |
| 125 | | − #[clap(long)] |
| 126 | | − /// The size in megabytes for a cache to speed up accessing entire objects, bypassing object database access when hit. |
| 127 | | − /// It is shared among all threads, so 4 threads would use their own cache 1/4th of the size. |
| 128 | | − /// |
| 129 | | − /// This cache type is currently only effective when using the 'diff-tree' object expansion. |
| 130 | | − /// |
| 131 | | − /// If unset, no cache will be used. |
| 132 | | − object_cache_size_mb: Option<usize>, |
| 117 | + #[clap(long)] |
| 118 | + /// if set, the counting phase may be accelerated using multithreading. |
| 119 | + /// |
| 120 | + /// On the flip side, however, one will loose deterministic counting results which affects the |
| 121 | + /// way the resulting pack is structured. |
| 122 | + nondeterministic_count: bool, |
| 133 | 123 | |
| 134 | | − #[clap(long)] |
| 135 | | − /// if set, delta-objects whose base object wouldn't be in the pack will not be recompressed as base object, but instead |
| 136 | | − /// refer to its base object using its object id. |
| 137 | | − /// |
| 138 | | − /// This allows for smaller packs but requires the receiver of the pack to resolve these ids before storing the pack. |
| 139 | | − /// Packs produced with this option enabled are only valid in transit, but not at rest. |
| 140 | | − thin: bool, |
| 124 | + #[clap(long, short = 's')] |
| 125 | + /// If set statistical information will be presented to inform about pack creation details. |
| 126 | + /// It's a form of instrumentation for developers to help improve pack generation. |
| 127 | + statistics: bool, |
| 141 | 128 | |
| 142 | | − /// The directory into which to write the pack file. |
| 143 | | − #[clap(long, short = 'o')] |
| 144 | | − output_directory: Option<PathBuf>, |
| 129 | + #[clap(long)] |
| 130 | + /// The size in megabytes for a cache to speed up pack access for packs with long delta chains. |
| 131 | + /// It is shared among all threads, so 4 threads would use their own cache 1/4th of the size. |
| 132 | + /// |
| 133 | + /// If unset, no cache will be used. |
| 134 | + pack_cache_size_mb: Option<usize>, |
| 145 | 135 | |
| 146 | | − /// The tips from which to start the commit graph iteration, either as fully qualified commit hashes |
| 147 | | − /// or as branch names. |
| 148 | | − /// |
| 149 | | − /// If empty, we expect to read objects on stdin and default to 'none' as expansion mode. |
| 150 | | − /// Otherwise the expansion mode is 'tree-traversal' by default. |
| 151 | | − tips: Vec<OsString>, |
| 152 | | − }, |
| 153 | | − /// Use the git-protocol to receive a pack, emulating a clone. |
| 154 | | − #[cfg(any(feature = "gitoxide-core-async-client", feature = "gitoxide-core-blocking-client"))] |
| 155 | | − Receive { |
| 156 | | − /// The protocol version to use. Valid values are 1 and 2 |
| 157 | | − #[clap(long, short = 'p')] |
| 158 | | − protocol: Option<core::net::Protocol>, |
| 136 | + #[clap(long)] |
| 137 | + /// The size in megabytes for a cache to speed up accessing entire objects, bypassing object database access when hit. |
| 138 | + /// It is shared among all threads, so 4 threads would use their own cache 1/4th of the size. |
| 139 | + /// |
| 140 | + /// This cache type is currently only effective when using the 'diff-tree' object expansion. |
| 141 | + /// |
| 142 | + /// If unset, no cache will be used. |
| 143 | + object_cache_size_mb: Option<usize>, |
| 159 | 144 | |
| 160 | | − /// the directory into which to write references. Existing files will be overwritten. |
| 161 | | − /// |
| 162 | | − /// Note that the directory will be created if needed. |
| 163 | | − #[clap(long, short = 'd')] |
| 164 | | − refs_directory: Option<PathBuf>, |
| 145 | + #[clap(long)] |
| 146 | + /// if set, delta-objects whose base object wouldn't be in the pack will not be recompressed as base object, but instead |
| 147 | + /// refer to its base object using its object id. |
| 148 | + /// |
| 149 | + /// This allows for smaller packs but requires the receiver of the pack to resolve these ids before storing the pack. |
| 150 | + /// Packs produced with this option enabled are only valid in transit, but not at rest. |
| 151 | + thin: bool, |
| 165 | 152 | |
| 166 | | − /// The URLs or path from which to receive the pack. |
| 167 | | − /// |
| 168 | | − /// See here for a list of supported URLs: <https://www.git-scm.com/docs/git-clone#_git_urls> |
| 169 | | − url: String, |
| 153 | + /// The directory into which to write the pack file. |
| 154 | + #[clap(long, short = 'o')] |
| 155 | + output_directory: Option<PathBuf>, |
| 170 | 156 | |
| 171 | | − /// If set once or more times, these references will be fetched instead of all advertised ones. |
| 172 | | − /// |
| 173 | | − /// Note that this requires a reasonably modern git server. |
| 174 | | − #[clap(long = "reference", short = 'r')] |
| 175 | | − refs: Vec<String>, |
| 157 | + /// The tips from which to start the commit graph iteration, either as fully qualified commit hashes |
| 158 | + /// or as branch names. |
| 159 | + /// |
| 160 | + /// If empty, we expect to read objects on stdin and default to 'none' as expansion mode. |
| 161 | + /// Otherwise the expansion mode is 'tree-traversal' by default. |
| 162 | + tips: Vec<OsString>, |
| 163 | + }, |
| 164 | + /// Use the git-protocol to receive a pack, emulating a clone. |
| 165 | + #[cfg(any(feature = "gitoxide-core-async-client", feature = "gitoxide-core-blocking-client"))] |
| 166 | + Receive { |
| 167 | + /// The protocol version to use. Valid values are 1 and 2 |
| 168 | + #[clap(long, short = 'p')] |
| 169 | + protocol: Option<core::net::Protocol>, |
| 176 | 170 | |
| 177 | | − /// The directory into which to write the received pack and index. |
| 178 | | − /// |
| 179 | | − /// If unset, they will be discarded. |
| 180 | | − directory: Option<PathBuf>, |
| 181 | | − }, |
| 182 | | − /// Dissolve a pack into its loose objects. |
| 183 | | − /// |
| 184 | | − /// Note that this effectively removes delta compression for an average compression of 2x, creating one file per object in the process. |
| 185 | | − /// Thus this should only be done to dissolve small packs after a fetch. |
| 186 | | − Explode { |
| 187 | | − #[clap(long)] |
| 188 | | − /// Read written objects back and assert they match their source. Fail the operation otherwise. |
| 189 | | − /// |
| 190 | | − /// Only relevant if an object directory is set. |
| 191 | | − verify: bool, |
| 171 | + /// the directory into which to write references. Existing files will be overwritten. |
| 172 | + /// |
| 173 | + /// Note that the directory will be created if needed. |
| 174 | + #[clap(long, short = 'd')] |
| 175 | + refs_directory: Option<PathBuf>, |
| 192 | 176 | |
| 193 | | − /// delete the pack and index file after the operation is successful |
| 194 | | − #[clap(long)] |
| 195 | | − delete_pack: bool, |
| 177 | + /// The URLs or path from which to receive the pack. |
| 178 | + /// |
| 179 | + /// See here for a list of supported URLs: <https://www.git-scm.com/docs/git-clone#_git_urls> |
| 180 | + url: String, |
| 196 | 181 | |
| 197 | | − /// The amount of checks to run |
| 198 | | − #[clap( |
| 199 | | − long, |
| 200 | | − short = 'c', |
| 201 | | − default_value = "all", |
| 202 | | − possible_values(core::pack::explode::SafetyCheck::variants()) |
| 203 | | − )] |
| 204 | | − check: core::pack::explode::SafetyCheck, |
| 182 | + /// If set once or more times, these references will be fetched instead of all advertised ones. |
| 183 | + /// |
| 184 | + /// Note that this requires a reasonably modern git server. |
| 185 | + #[clap(long = "reference", short = 'r')] |
| 186 | + refs: Vec<String>, |
| 205 | 187 | |
| 206 | | − /// Compress bytes even when using the sink, i.e. no object directory is specified |
| 188 | + /// The directory into which to write the received pack and index. |
| 189 | + /// |
| 190 | + /// If unset, they will be discarded. |
| 191 | + directory: Option<PathBuf>, |
| 192 | + }, |
| 193 | + /// Dissolve a pack into its loose objects. |
| 207 | 194 | /// |
| 208 | | − /// This helps to determine overhead related to compression. If unset, the sink will |
| 209 | | − /// only create hashes from bytes, which is usually limited by the speed at which input |
| 210 | | − /// can be obtained. |
| 211 | | − #[clap(long)] |
| 212 | | − sink_compress: bool, |
| 213 | | − |
| 214 | | − /// The '.pack' or '.idx' file to explode into loose objects |
| 215 | | − pack_path: PathBuf, |
| 216 | | − |
| 217 | | − /// The path into which all objects should be written. Commonly '.git/objects' |
| 218 | | − object_path: Option<PathBuf>, |
| 219 | | − }, |
| 220 | | − /// Verify the integrity of a pack, index or multi-index file |
| 221 | | − Verify { |
| 222 | | − #[clap(flatten)] |
| 223 | | − args: VerifyOptions, |
| 224 | | − |
| 225 | | − /// The '.pack', '.idx' or 'multi-pack-index' file to validate. |
| 226 | | − path: PathBuf, |
| 227 | | − }, |
| 228 | | − } |
| 195 | + /// Note that this effectively removes delta compression for an average compression of 2x, creating one file per object in the process. |
| 196 | + /// Thus this should only be done to dissolve small packs after a fetch. |
| 197 | + Explode { |
| 198 | + #[clap(long)] |
| 199 | + /// Read written objects back and assert they match their source. Fail the operation otherwise. |
| 200 | + /// |
| 201 | + /// Only relevant if an object directory is set. |
| 202 | + verify: bool, |
| 229 | 203 | |
| 230 | | − #[derive(Debug, clap::Parser)] |
| 231 | | − pub struct VerifyOptions { |
| 232 | | − /// output statistical information |
| 233 | | − #[clap(long, short = 's')] |
| 234 | | − pub statistics: bool, |
| 235 | | − /// The algorithm used to verify packs. They differ in costs. |
| 236 | | − #[clap( |
| 237 | | − long, |
| 238 | | − short = 'a', |
| 239 | | − default_value = "less-time", |
| 240 | | − possible_values(core::pack::verify::Algorithm::variants()) |
| 241 | | − )] |
| 242 | | − pub algorithm: core::pack::verify::Algorithm, |
| 243 | | − |
| 244 | | − #[clap(long, conflicts_with("re-encode"))] |
| 245 | | − /// Decode and parse tags, commits and trees to validate their correctness beyond hashing correctly. |
| 246 | | − /// |
| 247 | | − /// Malformed objects should not usually occur, but could be injected on purpose or accident. |
| 248 | | − /// This will reduce overall performance. |
| 249 | | − pub decode: bool, |
| 204 | + /// delete the pack and index file after the operation is successful |
| 205 | + #[clap(long)] |
| 206 | + delete_pack: bool, |
| 250 | 207 | |
| 251 | | − #[clap(long)] |
| 252 | | − /// Decode and parse tags, commits and trees to validate their correctness, and re-encode them. |
| 253 | | − /// |
| 254 | | − /// This flag is primarily to test the implementation of encoding, and requires to decode the object first. |
| 255 | | − /// Encoding an object after decoding it should yield exactly the same bytes. |
| 256 | | − /// This will reduce overall performance even more, as re-encoding requires to transform zero-copy objects into |
| 257 | | − /// owned objects, causing plenty of allocation to occour. |
| 258 | | − pub re_encode: bool, |
| 259 | | − } |
| 208 | + /// The amount of checks to run |
| 209 | + #[clap( |
| 210 | + long, |
| 211 | + short = 'c', |
| 212 | + default_value = "all", |
| 213 | + possible_values(core::pack::explode::SafetyCheck::variants()) |
| 214 | + )] |
| 215 | + check: core::pack::explode::SafetyCheck, |
| 260 | 216 | |
| 261 | | − /// |
| 262 | | − pub mod multi_index { |
| 263 | | − use std::path::PathBuf; |
| 217 | + /// Compress bytes even when using the sink, i.e. no object directory is specified |
| 218 | + /// |
| 219 | + /// This helps to determine overhead related to compression. If unset, the sink will |
| 220 | + /// only create hashes from bytes, which is usually limited by the speed at which input |
| 221 | + /// can be obtained. |
| 222 | + #[clap(long)] |
| 223 | + sink_compress: bool, |
| 264 | 224 | |
| 265 | | − #[derive(Debug, clap::Parser)] |
| 266 | | − pub struct Platform { |
| 267 | | − /// The path to the index file. |
| 268 | | − #[clap(short = 'i', long, default_value = ".git/objects/pack/multi-pack-index")] |
| 269 | | − pub multi_index_path: PathBuf, |
| 225 | + /// The '.pack' or '.idx' file to explode into loose objects |
| 226 | + pack_path: PathBuf, |
| 270 | 227 | |
| 271 | | − /// Subcommands |
| 272 | | − #[clap(subcommand)] |
| 273 | | − pub cmd: Subcommands, |
| 274 | | − } |
| 228 | + /// The path into which all objects should be written. Commonly '.git/objects' |
| 229 | + object_path: Option<PathBuf>, |
| 230 | + }, |
| 231 | + /// Verify the integrity of a pack, index or multi-index file |
| 232 | + Verify { |
| 233 | + #[clap(flatten)] |
| 234 | + args: VerifyOptions, |
| 275 | 235 | |
| 276 | | − #[derive(Debug, clap::Subcommand)] |
| 277 | | − pub enum Subcommands { |
| 278 | | − /// Display all entries of a multi-index: <oid> <pack-id> <pack-offset> |
| 279 | | − Entries, |
| 280 | | − /// Print general information about a multi-index file |
| 281 | | − Info, |
| 282 | | − /// Verify a multi-index quickly without inspecting objects themselves |
| 283 | | − Verify, |
| 284 | | − /// Create a multi-pack index from one or more pack index files, overwriting possibloy existing files. |
| 285 | | − Create { |
| 286 | | − /// Paths to the pack index files to read (with .idx extension). |
| 287 | | − /// |
| 288 | | − /// Note for the multi-index to be useful, it should be side-by-side with the supplied `.idx` files. |
| 289 | | − #[clap(required = true)] |
| 290 | | − index_paths: Vec<PathBuf>, |
| 236 | + /// The '.pack', '.idx' or 'multi-pack-index' file to validate. |
| 237 | + path: PathBuf, |
| 291 | 238 | }, |
| 292 | 239 | } |
| 293 | | − } |
| 294 | | − |
| 295 | | − /// |
| 296 | | − pub mod index { |
| 297 | | − use std::path::PathBuf; |
| 298 | 240 | |
| 299 | | − use gitoxide_core as core; |
| 241 | + #[derive(Debug, clap::Parser)] |
| 242 | + pub struct VerifyOptions { |
| 243 | + /// output statistical information |
| 244 | + #[clap(long, short = 's')] |
| 245 | + pub statistics: bool, |
| 246 | + /// The algorithm used to verify packs. They differ in costs. |
| 247 | + #[clap( |
| 248 | + long, |
| 249 | + short = 'a', |
| 250 | + default_value = "less-time", |
| 251 | + possible_values(core::pack::verify::Algorithm::variants()) |
| 252 | + )] |
| 253 | + pub algorithm: core::pack::verify::Algorithm, |
| 300 | 254 | |
| 301 | | − #[derive(Debug, clap::Subcommand)] |
| 302 | | − pub enum Subcommands { |
| 303 | | − /// create a pack index from a pack data file. |
| 304 | | − Create { |
| 305 | | − /// Specify how to iterate the pack, defaults to 'verify' |
| 306 | | − /// |
| 307 | | − /// Valid values are |
| 308 | | − /// |
| 309 | | − /// **as-is** do not do anything and expect the pack file to be valid as per the trailing hash, |
| 310 | | − /// **verify** the input ourselves and validate that it matches with the hash provided in the pack, |
| 311 | | − /// **restore** hash the input ourselves and ignore failing entries, instead finish the pack with the hash we computed |
| 312 | | − /// to keep as many objects as possible. |
| 313 | | − #[clap( |
| 314 | | − long, |
| 315 | | − short = 'i', |
| 316 | | − default_value = "verify", |
| 317 | | − possible_values(core::pack::index::IterationMode::variants()) |
| 318 | | − )] |
| 319 | | − iteration_mode: core::pack::index::IterationMode, |
| 255 | + #[clap(long, conflicts_with("re-encode"))] |
| 256 | + /// Decode and parse tags, commits and trees to validate their correctness beyond hashing correctly. |
| 257 | + /// |
| 258 | + /// Malformed objects should not usually occur, but could be injected on purpose or accident. |
| 259 | + /// This will reduce overall performance. |
| 260 | + pub decode: bool, |
| 320 | 261 | |
| 321 | | − /// Path to the pack file to read (with .pack extension). |
| 322 | | − /// |
| 323 | | − /// If unset, the pack file is expected on stdin. |
| 324 | | − #[clap(long, short = 'p')] |
| 325 | | − pack_path: Option<PathBuf>, |
| 262 | + #[clap(long)] |
| 263 | + /// Decode and parse tags, commits and trees to validate their correctness, and re-encode them. |
| 264 | + /// |
| 265 | + /// This flag is primarily to test the implementation of encoding, and requires to decode the object first. |
| 266 | + /// Encoding an object after decoding it should yield exactly the same bytes. |
| 267 | + /// This will reduce overall performance even more, as re-encoding requires to transform zero-copy objects into |
| 268 | + /// owned objects, causing plenty of allocation to occour. |
| 269 | + pub re_encode: bool, |
| 270 | + } |
| 326 | 271 | |
| 327 | | − /// The folder into which to place the pack and the generated index file |
| 328 | | − /// |
| 329 | | − /// If unset, only informational output will be provided to standard output. |
| 330 | | − directory: Option<PathBuf>, |
| 331 | | − }, |
| 272 | + /// |
| 273 | + pub mod multi_index { |
| 274 | + use std::path::PathBuf; |
| 275 | + |
| 276 | + #[derive(Debug, clap::Parser)] |
| 277 | + pub struct Platform { |
| 278 | + /// The path to the index file. |
| 279 | + #[clap(short = 'i', long, default_value = ".git/objects/pack/multi-pack-index")] |
| 280 | + pub multi_index_path: PathBuf, |
| 281 | + |
| 282 | + /// Subcommands |
| 283 | + #[clap(subcommand)] |
| 284 | + pub cmd: Subcommands, |
| 285 | + } |
| 286 | + |
| 287 | + #[derive(Debug, clap::Subcommand)] |
| 288 | + pub enum Subcommands { |
| 289 | + /// Display all entries of a multi-index: <oid> <pack-id> <pack-offset> |
| 290 | + Entries, |
| 291 | + /// Print general information about a multi-index file |
| 292 | + Info, |
| 293 | + /// Verify a multi-index quickly without inspecting objects themselves |
| 294 | + Verify, |
| 295 | + /// Create a multi-pack index from one or more pack index files, overwriting possibloy existing files. |
| 296 | + Create { |
| 297 | + /// Paths to the pack index files to read (with .idx extension). |
| 298 | + /// |
| 299 | + /// Note for the multi-index to be useful, it should be side-by-side with the supplied `.idx` files. |
| 300 | + #[clap(required = true)] |
| 301 | + index_paths: Vec<PathBuf>, |
| 302 | + }, |
| 303 | + } |
| 332 | 304 | } |
| 333 | | − } |
| 334 | | −} |
| 335 | 305 | |
| 336 | | −/// |
| 337 | | −pub mod free { |
| 338 | | − #[derive(Debug, clap::Subcommand)] |
| 339 | | − pub enum Subcommands { |
| 340 | | − /// Subcommands for interacting with mailmaps |
| 341 | | − Mailmap { |
| 342 | | − #[clap(flatten)] |
| 343 | | − cmd: mailmap::Platform, |
| 344 | | − }, |
| 306 | + /// |
| 307 | + pub mod index { |
| 308 | + use std::path::PathBuf; |
| 309 | + |
| 310 | + use gitoxide_core as core; |
| 311 | + |
| 312 | + #[derive(Debug, clap::Subcommand)] |
| 313 | + pub enum Subcommands { |
| 314 | + /// create a pack index from a pack data file. |
| 315 | + Create { |
| 316 | + /// Specify how to iterate the pack, defaults to 'verify' |
| 317 | + /// |
| 318 | + /// Valid values are |
| 319 | + /// |
| 320 | + /// **as-is** do not do anything and expect the pack file to be valid as per the trailing hash, |
| 321 | + /// **verify** the input ourselves and validate that it matches with the hash provided in the pack, |
| 322 | + /// **restore** hash the input ourselves and ignore failing entries, instead finish the pack with the hash we computed |
| 323 | + /// to keep as many objects as possible. |
| 324 | + #[clap( |
| 325 | + long, |
| 326 | + short = 'i', |
| 327 | + default_value = "verify", |
| 328 | + possible_values(core::pack::index::IterationMode::variants()) |
| 329 | + )] |
| 330 | + iteration_mode: core::pack::index::IterationMode, |
| 331 | + |
| 332 | + /// Path to the pack file to read (with .pack extension). |
| 333 | + /// |
| 334 | + /// If unset, the pack file is expected on stdin. |
| 335 | + #[clap(long, short = 'p')] |
| 336 | + pack_path: Option<PathBuf>, |
| 337 | + |
| 338 | + /// The folder into which to place the pack and the generated index file |
| 339 | + /// |
| 340 | + /// If unset, only informational output will be provided to standard output. |
| 341 | + directory: Option<PathBuf>, |
| 342 | + }, |
| 343 | + } |
| 344 | + } |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | /// |
| @@ -382,7 +382,7 @@ pub mod repo { · 34 unmodified lines |
| 382 | 382 | /// Verify the integrity of the entire repository |
| 383 | 383 | Verify { |
| 384 | 384 | #[clap(flatten)] |
| 385 | | − args: super::pack::VerifyOptions, |
| 385 | + args: super::free::pack::VerifyOptions, |
| 386 | 386 | }, |
| 387 | 387 | /// Interact with commit objects. |
| 388 | 388 | Commit { |