Use strings for paths and buffer contents

This commit is contained in:
Max Brunsfeld
2021-06-17 16:25:30 -07:00
parent f4dccc5353
commit 3a78f053f6
4 changed files with 14 additions and 14 deletions
+4 -4
View File
@@ -45,7 +45,7 @@ message OpenWorktreeResponse {
message OpenBuffer {
uint64 worktree_id = 1;
bytes path = 2;
string path = 2;
}
message OpenBufferResponse {
@@ -53,13 +53,13 @@ message OpenBufferResponse {
}
message Worktree {
repeated bytes paths = 1;
repeated string paths = 1;
}
message Buffer {
uint64 id = 1;
bytes path = 2;
bytes content = 3;
string path = 2;
string content = 3;
repeated Operation history = 4;
}
+8 -8
View File
@@ -340,7 +340,7 @@ mod tests {
};
let response1 = proto::OpenWorktreeResponse {
worktree: Some(proto::Worktree {
paths: vec![b"path/one".to_vec()],
paths: vec!["path/one".to_string()],
}),
};
let request2 = proto::OpenWorktree {
@@ -349,30 +349,30 @@ mod tests {
};
let response2 = proto::OpenWorktreeResponse {
worktree: Some(proto::Worktree {
paths: vec![b"path/two".to_vec(), b"path/three".to_vec()],
paths: vec!["path/two".to_string(), "path/three".to_string()],
}),
};
let request3 = proto::OpenBuffer {
worktree_id: 102,
path: b"path/two".to_vec(),
path: "path/two".to_string(),
};
let response3 = proto::OpenBufferResponse {
buffer: Some(proto::Buffer {
id: 1001,
path: b"path/two".to_vec(),
content: b"path/two content".to_vec(),
path: "path/two".to_string(),
content: "path/two content".to_string(),
history: vec![],
}),
};
let request4 = proto::OpenBuffer {
worktree_id: 101,
path: b"path/one".to_vec(),
path: "path/one".to_string(),
};
let response4 = proto::OpenBufferResponse {
buffer: Some(proto::Buffer {
id: 1002,
path: b"path/one".to_vec(),
content: b"path/one content".to_vec(),
path: "path/one".to_string(),
content: "path/one content".to_string(),
history: vec![],
}),
};
+1 -1
View File
@@ -131,7 +131,7 @@ mod tests {
let message2 = ShareWorktree {
worktree: Some(Worktree {
paths: vec![b"ok".to_vec()],
paths: vec!["ok".to_string()],
}),
}
.into_envelope(5, None);
+1 -1
View File
@@ -239,7 +239,7 @@ impl Worktree {
.spawn(async move {
snapshot
.paths()
.map(|path| path.as_os_str().as_bytes().to_vec())
.map(|path| path.to_string_lossy().to_string())
.collect()
})
.await;