cleanup TODO

This commit is contained in:
Stephan Dilly 2020-06-12 15:04:52 +02:00
parent 6ebe717fb1
commit 43905cfa6b
6 changed files with 15 additions and 25 deletions

View file

@ -156,7 +156,7 @@ impl AsyncStatus {
include_untracked: bool,
) -> Result<Status> {
Ok(Status {
items: sync::status::get_status_new(
items: sync::status::get_status(
CWD,
status_type,
include_untracked,

View file

@ -298,9 +298,7 @@ mod tests {
let root = repo.path().parent().unwrap();
let repo_path = root.as_os_str().to_str().unwrap();
let res =
get_status(repo_path, StatusType::WorkingDir).unwrap();
assert_eq!(res.len(), 0);
assert_eq!(get_statuses(repo_path), (0, 0));
fs::create_dir(&root.join("foo")).unwrap();
File::create(&root.join("foo/bar.txt"))
@ -308,9 +306,7 @@ mod tests {
.write_all(b"test\nfoo")
.unwrap();
let res =
get_status(repo_path, StatusType::WorkingDir).unwrap();
assert_eq!(res.len(), 1);
assert_eq!(get_statuses(repo_path), (1, 0));
let diff =
get_diff(repo_path, "foo/bar.txt".to_string(), false)
@ -393,8 +389,8 @@ mod tests {
.unwrap();
}
let res =
get_status(repo_path, StatusType::WorkingDir).unwrap();
let res = get_status(repo_path, StatusType::WorkingDir, true)
.unwrap();
assert_eq!(res.len(), 1);
assert_eq!(res[0].path, "bar.txt");

View file

@ -79,10 +79,12 @@ mod tests {
/// helper returning amount of files with changes in the (wd,stage)
pub fn get_statuses(repo_path: &str) -> (usize, usize) {
(
get_status(repo_path, StatusType::WorkingDir)
get_status(repo_path, StatusType::WorkingDir, true)
.unwrap()
.len(),
get_status(repo_path, StatusType::Stage, true)
.unwrap()
.len(),
get_status(repo_path, StatusType::Stage).unwrap().len(),
)
}

View file

@ -96,8 +96,8 @@ mod tests {
let root = repo.path().parent().unwrap();
let repo_path = root.as_os_str().to_str().unwrap();
let res =
get_status(repo_path, StatusType::WorkingDir).unwrap();
let res = get_status(repo_path, StatusType::WorkingDir, true)
.unwrap();
assert_eq!(res.len(), 0);
let file_path = root.join("bar.txt");

View file

@ -84,18 +84,10 @@ impl Into<StatusShow> for StatusType {
}
}
/// TODO: migrate
///
pub fn get_status(
repo_path: &str,
status_type: StatusType,
) -> Result<Vec<StatusItem>> {
get_status_new(repo_path, status_type, true)
}
/// TODO: migrate
pub fn get_status_new(
repo_path: &str,
status_type: StatusType,
include_untracked: bool,
) -> Result<Vec<StatusItem>> {
scope_time!("get_status");

View file

@ -232,7 +232,7 @@ mod tests {
let repo_path = root.as_os_str().to_str().unwrap();
let status_count = |s: StatusType| -> usize {
get_status(repo_path, s).unwrap().len()
get_status(repo_path, s, true).unwrap().len()
};
fs::create_dir_all(&root.join("a/d"))?;
@ -261,7 +261,7 @@ mod tests {
let repo_path = root.as_os_str().to_str().unwrap();
let status_count = |s: StatusType| -> usize {
get_status(repo_path, s).unwrap().len()
get_status(repo_path, s, true).unwrap().len()
};
let full_path = &root.join(file_path);
@ -295,7 +295,7 @@ mod tests {
let repo_path = root.as_os_str().to_str().unwrap();
let status_count = |s: StatusType| -> usize {
get_status(repo_path, s).unwrap().len()
get_status(repo_path, s, true).unwrap().len()
};
let sub = &root.join("sub");