mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-10-27 13:39:19 +03:00
consider adding the same hunk an update
This commit is contained in:
parent
16b70977c4
commit
3c579ef577
@ -48,10 +48,6 @@ impl TryFrom<&str> for Ownership {
|
||||
|
||||
impl Ownership {
|
||||
pub fn put(&mut self, ownership: &FileOwnership) {
|
||||
if self.files.contains(ownership) {
|
||||
return;
|
||||
}
|
||||
|
||||
let target = self
|
||||
.files
|
||||
.iter()
|
||||
@ -172,6 +168,22 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_put_4() {
|
||||
let mut ownership = Ownership::try_from("src/main.rs:0-100\nsrc/main2.rs:100-200").unwrap();
|
||||
ownership.put(&FileOwnership::try_from("src/main2.rs:100-200").unwrap());
|
||||
assert_eq!(ownership.files.len(), 2);
|
||||
assert_eq!(
|
||||
ownership.files[0],
|
||||
FileOwnership::try_from("src/main2.rs:100-200").unwrap()
|
||||
);
|
||||
assert_eq!(
|
||||
ownership.files[1],
|
||||
FileOwnership::try_from("src/main.rs:0-100").unwrap()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
#[test]
|
||||
fn test_put_7() {
|
||||
let mut ownership = Ownership::try_from("src/main.rs:100-200").unwrap();
|
||||
|
Loading…
Reference in New Issue
Block a user