File tree 3 files changed +15
-1
lines changed
gitoxide-core/src/repository
3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -14,17 +14,20 @@ pub mod query {
14
14
pub format : OutputFormat ,
15
15
pub overrides : Vec < OsString > ,
16
16
pub show_ignore_patterns : bool ,
17
+ pub statistics : bool ,
17
18
}
18
19
}
19
20
20
21
pub fn query (
21
22
repo : gix:: Repository ,
22
23
pathspecs : impl Iterator < Item = gix:: path:: Spec > ,
23
24
mut out : impl io:: Write ,
25
+ mut err : impl io:: Write ,
24
26
query:: Options {
25
27
overrides,
26
28
format,
27
29
show_ignore_patterns,
30
+ statistics,
28
31
} : query:: Options ,
29
32
) -> anyhow:: Result < ( ) > {
30
33
if format != OutputFormat :: Human {
@@ -62,5 +65,10 @@ pub fn query(
62
65
}
63
66
}
64
67
}
68
+
69
+ if let Some ( stats) = statistics. then ( || cache. take_statistics ( ) ) {
70
+ out. flush ( ) ?;
71
+ writeln ! ( err, "{:#?}" , stats) . ok ( ) ;
72
+ }
65
73
Ok ( ( ) )
66
74
}
Original file line number Diff line number Diff line change @@ -862,6 +862,7 @@ pub fn main() -> Result<()> {
862
862
} ,
863
863
Subcommands :: Exclude ( cmd) => match cmd {
864
864
exclude:: Subcommands :: Query {
865
+ statistics,
865
866
patterns,
866
867
pathspecs,
867
868
show_ignore_patterns,
@@ -871,7 +872,7 @@ pub fn main() -> Result<()> {
871
872
progress,
872
873
progress_keep_open,
873
874
None ,
874
- move |_progress, out, _err | {
875
+ move |_progress, out, err | {
875
876
use gix:: bstr:: ByteSlice ;
876
877
core:: repository:: exclude:: query (
877
878
repository ( Mode :: Strict ) ?,
@@ -886,10 +887,12 @@ pub fn main() -> Result<()> {
886
887
Box :: new ( pathspecs. into_iter ( ) )
887
888
} ,
888
889
out,
890
+ err,
889
891
core:: repository:: exclude:: query:: Options {
890
892
format,
891
893
show_ignore_patterns,
892
894
overrides : patterns,
895
+ statistics,
893
896
} ,
894
897
)
895
898
} ,
Original file line number Diff line number Diff line change @@ -469,6 +469,9 @@ pub mod exclude {
469
469
pub enum Subcommands {
470
470
/// Check if path-specs are excluded and print the result similar to `git check-ignore`.
471
471
Query {
472
+ /// Print various statistics to stderr
473
+ #[ clap( long, short = 's' ) ]
474
+ statistics : bool ,
472
475
/// Show actual ignore patterns instead of un-excluding an entry.
473
476
///
474
477
/// That way one can understand why an entry might not be excluded.
You can’t perform that action at this time.
0 commit comments