@@ -17,7 +17,7 @@ pub fn repo(name: &str) -> crate::Result<gix::Repository> {
17
17
}
18
18
19
19
mod into_iter {
20
-
use gix::status::{tree_index::TrackRenames, Item};
20
+
use gix::status::{tree_index::TrackRenames, Item, Submodule};
21
21
use gix_diff::Rewrites;
22
22
use gix_testtools::size_ok;
23
23
@@ -53,24 +53,149 @@ mod into_iter {
53
53
let mut items: Vec<_> = status.by_ref().filter_map(Result::ok).collect();
54
54
items.sort_by(|a, b| a.location().cmp(b.location()));
55
55
assert_eq!(items.len(), 3, "1 untracked, 1 move, 1 submodule modification");
56
-
insta::assert_debug_snapshot!(&items[1], @r#"
57
-
TreeIndex(
58
-
Rewrite {
59
-
source_location: "this",
60
-
source_index: 2,
61
-
source_entry_mode: Mode(
62
-
FILE,
63
-
),
64
-
source_id: Sha1(e69de29bb2d1d6434b8b29ae775ad8c2e48c5391),
65
-
location: "that",
66
-
index: 2,
67
-
entry_mode: Mode(
68
-
FILE,
69
-
),
70
-
id: Sha1(e69de29bb2d1d6434b8b29ae775ad8c2e48c5391),
71
-
copy: false,
72
-
},
73
-
)
56
+
insta::assert_debug_snapshot!(&items[1..], @r#"
57
+
[
58
+
TreeIndex(
59
+
Rewrite {
60
+
source_location: "this",
61
+
source_index: 2,
62
+
source_entry_mode: Mode(
63
+
FILE,
64
+
),
65
+
source_id: Sha1(e69de29bb2d1d6434b8b29ae775ad8c2e48c5391),
66
+
location: "that",
67
+
index: 2,
68
+
entry_mode: Mode(
69
+
FILE,
70
+
),
71
+
id: Sha1(e69de29bb2d1d6434b8b29ae775ad8c2e48c5391),
72
+
copy: false,
73
+
},
74
+
),
75
+
IndexWorktree(
76
+
DirectoryContents {
77
+
entry: Entry {
78
+
rela_path: "untracked",
79
+
status: Untracked,
80
+
property: None,
81
+
disk_kind: Some(
82
+
File,
83
+
),
84
+
index_kind: None,
85
+
pathspec_match: Some(
86
+
Always,
87
+
),
88
+
},
89
+
collapsed_directory_status: None,
90
+
},
91
+
),
92
+
]
93
+
"#);
94
+
Ok(())
95
+
}
96
+
97
+
#[test]
98
+
fn submodule_fully_ignored_by_override() -> crate::Result {
99
+
let repo = submodule_repo("git-mv-and-untracked-and-submodule-head-changed-and-modified")?;
100
+
let mut status = repo
101
+
.status(gix::progress::Discard)?
102
+
.index_worktree_options_mut(|opts| {
103
+
opts.sorting =
104
+
Some(gix::status::plumbing::index_as_worktree_with_renames::Sorting::ByPathCaseSensitive);
105
+
})
106
+
.tree_index_track_renames(TrackRenames::Given(Rewrites {
107
+
track_empty: true,
108
+
..Default::default()
109
+
}))
110
+
.index_worktree_submodules(Some(Submodule::Given {
111
+
ignore: gix::submodule::config::Ignore::All,
112
+
check_dirty: false,
113
+
}))
114
+
.into_iter(None)?;
115
+
let mut items: Vec<_> = status.by_ref().filter_map(Result::ok).collect();
116
+
items.sort_by(|a, b| a.location().cmp(b.location()));
117
+
assert_eq!(
118
+
items.len(),
119
+
2,
120
+
"1 untracked, 1 move, 0 submodule modification (ignored)"
121
+
);
122
+
insta::assert_debug_snapshot!(&items, @r#"
123
+
[
124
+
TreeIndex(
125
+
Rewrite {
126
+
source_location: "this",
127
+
source_index: 2,
128
+
source_entry_mode: Mode(
129
+
FILE,
130
+
),
131
+
source_id: Sha1(e69de29bb2d1d6434b8b29ae775ad8c2e48c5391),
132
+
location: "that",
133
+
index: 2,
134
+
entry_mode: Mode(
135
+
FILE,
136
+
),
137
+
id: Sha1(e69de29bb2d1d6434b8b29ae775ad8c2e48c5391),
138
+
copy: false,
139
+
},
140
+
),
141
+
IndexWorktree(
142
+
DirectoryContents {
143
+
entry: Entry {
144
+
rela_path: "untracked",
145
+
status: Untracked,
146
+
property: None,
147
+
disk_kind: Some(
148
+
File,
149
+
),
150
+
index_kind: None,
151
+
pathspec_match: Some(
152
+
Always,
153
+
),
154
+
},
155
+
collapsed_directory_status: None,
156
+
},
157
+
),
158
+
]
159
+
"#);
160
+
Ok(())
161
+
}
162
+
#[test]
163
+
fn submodule_fully_ignored_by_configuration() -> crate::Result {
164
+
let repo = submodule_repo("git-mv-and-untracked-and-submodule-head-changed-and-modified-ignore-all")?;
165
+
let mut status = repo
166
+
.status(gix::progress::Discard)?
167
+
.index_worktree_options_mut(|opts| {
168
+
opts.sorting =
169
+
Some(gix::status::plumbing::index_as_worktree_with_renames::Sorting::ByPathCaseSensitive);
170
+
})
171
+
.tree_index_track_renames(TrackRenames::Given(Rewrites {
172
+
track_empty: true,
173
+
..Default::default()
174
+
}))
175
+
.into_iter(None)?;
176
+
let mut items: Vec<_> = status.by_ref().filter_map(Result::ok).collect();
177
+
items.sort_by(|a, b| a.location().cmp(b.location()));
178
+
assert_eq!(items.len(), 1, "1 untracked, 0 submodule modification (ignored)");
179
+
insta::assert_debug_snapshot!(&items, @r#"
180
+
[
181
+
IndexWorktree(
182
+
DirectoryContents {
183
+
entry: Entry {
184
+
rela_path: "untracked",
185
+
status: Untracked,
186
+
property: None,
187
+
disk_kind: Some(
188
+
File,
189
+
),
190
+
index_kind: None,
191
+
pathspec_match: Some(
192
+
Always,
193
+
),
194
+
},
195
+
collapsed_directory_status: None,
196
+
},
197
+
),
198
+
]
74
199
"#);
75
200
Ok(())
76
201
}
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4