@@ -210,40 +210,46 @@ pub mod pack {
210210 /// Verify the integrity of a pack, index or multi-index file
211211 #[ clap( setting = AppSettings :: DisableVersionFlag ) ]
212212 Verify {
213- /// output statistical information about the pack
214- #[ clap( long, short = 's' ) ]
215- statistics : bool ,
216- /// The algorithm used to verify the pack. They differ in costs.
217- #[ clap(
218- long,
219- short = 'a' ,
220- default_value = "less-time" ,
221- possible_values( core:: pack:: verify:: Algorithm :: variants( ) )
222- ) ]
223- algorithm : core:: pack:: verify:: Algorithm ,
224-
225- #[ clap( long, conflicts_with( "re-encode" ) ) ]
226- /// Decode and parse tags, commits and trees to validate their correctness beyond hashing correctly.
227- ///
228- /// Malformed objects should not usually occur, but could be injected on purpose or accident.
229- /// This will reduce overall performance.
230- decode : bool ,
231-
232- #[ clap( long) ]
233- /// Decode and parse tags, commits and trees to validate their correctness, and re-encode them.
234- ///
235- /// This flag is primarily to test the implementation of encoding, and requires to decode the object first.
236- /// Encoding an object after decoding it should yield exactly the same bytes.
237- /// This will reduce overall performance even more, as re-encoding requires to transform zero-copy objects into
238- /// owned objects, causing plenty of allocation to occour.
239- re_encode : bool ,
213+ #[ clap( flatten) ]
214+ args : VerifyOptions ,
240215
241216 /// The '.pack', '.idx' or 'multi-pack-index' file to validate.
242217 #[ clap( parse( from_os_str) ) ]
243218 path : PathBuf ,
244219 } ,
245220 }
246221
222+ #[ derive( Debug , clap:: Parser ) ]
223+ pub struct VerifyOptions {
224+ /// output statistical information
225+ #[ clap( long, short = 's' ) ]
226+ pub statistics : bool ,
227+ /// The algorithm used to verify packs. They differ in costs.
228+ #[ clap(
229+ long,
230+ short = 'a' ,
231+ default_value = "less-time" ,
232+ possible_values( core:: pack:: verify:: Algorithm :: variants( ) )
233+ ) ]
234+ pub algorithm : core:: pack:: verify:: Algorithm ,
235+
236+ #[ clap( long, conflicts_with( "re-encode" ) ) ]
237+ /// Decode and parse tags, commits and trees to validate their correctness beyond hashing correctly.
238+ ///
239+ /// Malformed objects should not usually occur, but could be injected on purpose or accident.
240+ /// This will reduce overall performance.
241+ pub decode : bool ,
242+
243+ #[ clap( long) ]
244+ /// Decode and parse tags, commits and trees to validate their correctness, and re-encode them.
245+ ///
246+ /// This flag is primarily to test the implementation of encoding, and requires to decode the object first.
247+ /// Encoding an object after decoding it should yield exactly the same bytes.
248+ /// This will reduce overall performance even more, as re-encoding requires to transform zero-copy objects into
249+ /// owned objects, causing plenty of allocation to occour.
250+ pub re_encode : bool ,
251+ }
252+
247253 ///
248254 pub mod multi_index {
249255 use std:: path:: PathBuf ;
@@ -330,6 +336,8 @@ pub mod repo {
330336 /// Verify the integrity of the entire repository
331337 #[ clap( setting = AppSettings :: DisableVersionFlag ) ]
332338 Verify {
339+ #[ clap( flatten) ]
340+ args : super :: pack:: VerifyOptions ,
333341 #[ clap( short = 'r' , long, default_value = "." ) ]
334342 repository : PathBuf ,
335343 } ,
0 commit comments