Skip to content

Commit 62cb6eb

Browse files
committed
one more test bytes the dust, but…
…it looks like normalization is now broken, probably some incorrect handling of modifications, which previously only showed up as deletion and addition.
1 parent 276e726 commit 62cb6eb

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

src/index/diff/delegate.rs

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,17 @@ impl Delegate {
6868
let mut lines_before = input.before
6969
[before.start as usize..before.end as usize]
7070
.iter()
71-
.map(|&line| input.interner[line])
71+
.map(|&line| input.interner[line].as_bstr())
7272
.peekable();
7373
let mut lines_after = input.after
7474
[after.start as usize..after.end as usize]
7575
.iter()
76-
.map(|&line| input.interner[line])
76+
.map(|&line| input.interner[line].as_bstr())
7777
.peekable();
7878
match (lines_before.peek().is_some(), lines_after.peek().is_some()) {
7979
(true, false) => {
8080
for removed in lines_before {
81-
match version_from_json_line(removed.as_bstr(), location) {
81+
match version_from_json_line(removed, location) {
8282
Ok(version) => {
8383
self.delete_version_ids.insert(version.id());
8484
}
@@ -91,7 +91,7 @@ impl Delegate {
9191
}
9292
(false, true) => {
9393
for inserted in lines_after {
94-
match version_from_json_line(inserted.as_bstr(), location) {
94+
match version_from_json_line(inserted, location) {
9595
Ok(version) => {
9696
self.changes.push(if version.yanked {
9797
Change::Yanked(version)
@@ -106,9 +106,25 @@ impl Delegate {
106106
}
107107
}
108108
}
109-
(true, true) | (false, false) => {
110-
/* ignore modifications, shouldn't exist */
109+
(true, true) => {
110+
// These should always be yanked, but we check it anyway.
111+
for inserted in lines_after {
112+
match version_from_json_line(inserted, location) {
113+
Ok(version) => {
114+
self.changes.push(if version.yanked {
115+
Change::Yanked(version)
116+
} else {
117+
Change::Added(version)
118+
});
119+
}
120+
Err(e) => {
121+
err = Some(e);
122+
break;
123+
}
124+
}
125+
}
111126
}
127+
(false, false) => {}
112128
}
113129
},
114130
);

0 commit comments

Comments
 (0)