1
1
//! exclude information
2
- use crate :: { config, Repository } ;
2
+ use crate :: { config, AttributeStack , Repository } ;
3
3
4
4
/// The error returned by [`Repository::attributes()`].
5
5
#[ derive( Debug , thiserror:: Error ) ]
@@ -24,15 +24,13 @@ impl Repository {
24
24
///
25
25
/// * `$XDG_CONFIG_HOME/…/ignore|attributes` if `core.excludesFile|attributesFile` is *not* set, otherwise use the configured file.
26
26
/// * `$GIT_DIR/info/exclude|attributes` if present.
27
- // TODO: test, provide higher-level custom Cache wrapper that is much easier to use and doesn't panic when accessing entries
28
- // by non-relative path.
29
27
pub fn attributes (
30
28
& self ,
31
29
index : & gix_index:: State ,
32
30
attributes_source : gix_worktree:: stack:: state:: attributes:: Source ,
33
31
ignore_source : gix_worktree:: stack:: state:: ignore:: Source ,
34
32
exclude_overrides : Option < gix_ignore:: Search > ,
35
- ) -> Result < gix_worktree :: Stack , Error > {
33
+ ) -> Result < AttributeStack < ' _ > , Error > {
36
34
let case = if self . config . ignore_case {
37
35
gix_glob:: pattern:: Case :: Fold
38
36
} else {
@@ -48,13 +46,16 @@ impl Repository {
48
46
. assemble_exclude_globals ( self . git_dir ( ) , exclude_overrides, ignore_source, & mut buf) ?;
49
47
let state = gix_worktree:: stack:: State :: AttributesAndIgnoreStack { attributes, ignore } ;
50
48
let attribute_list = state. id_mappings_from_index ( index, index. path_backing ( ) , case) ;
51
- Ok ( gix_worktree:: Stack :: new (
52
- // this is alright as we don't cause mutation of that directory, it's virtual.
53
- self . work_dir ( ) . unwrap_or ( self . git_dir ( ) ) ,
54
- state,
55
- case,
56
- buf,
57
- attribute_list,
49
+ Ok ( AttributeStack :: new (
50
+ gix_worktree:: Stack :: new (
51
+ // this is alright as we don't cause mutation of that directory, it's virtual.
52
+ self . work_dir ( ) . unwrap_or ( self . git_dir ( ) ) ,
53
+ state,
54
+ case,
55
+ buf,
56
+ attribute_list,
57
+ ) ,
58
+ self ,
58
59
) )
59
60
}
60
61
@@ -63,7 +64,7 @@ impl Repository {
63
64
& self ,
64
65
index : & gix_index:: State ,
65
66
attributes_source : gix_worktree:: stack:: state:: attributes:: Source ,
66
- ) -> Result < gix_worktree :: Stack , config:: attribute_stack:: Error > {
67
+ ) -> Result < AttributeStack < ' _ > , config:: attribute_stack:: Error > {
67
68
let case = if self . config . ignore_case {
68
69
gix_glob:: pattern:: Case :: Fold
69
70
} else {
@@ -76,13 +77,16 @@ impl Repository {
76
77
) ?;
77
78
let state = gix_worktree:: stack:: State :: AttributesStack ( attributes) ;
78
79
let attribute_list = state. id_mappings_from_index ( index, index. path_backing ( ) , case) ;
79
- Ok ( gix_worktree:: Stack :: new (
80
- // this is alright as we don't cause mutation of that directory, it's virtual.
81
- self . work_dir ( ) . unwrap_or ( self . git_dir ( ) ) ,
82
- state,
83
- case,
84
- buf,
85
- attribute_list,
80
+ Ok ( AttributeStack :: new (
81
+ gix_worktree:: Stack :: new (
82
+ // this is alright as we don't cause mutation of that directory, it's virtual.
83
+ self . work_dir ( ) . unwrap_or ( self . git_dir ( ) ) ,
84
+ state,
85
+ case,
86
+ buf,
87
+ attribute_list,
88
+ ) ,
89
+ self ,
86
90
) )
87
91
}
88
92
0 commit comments