Skip to content

fix path handling on windows #762

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Fixed
- wrong file with same name shown in file tree ([#748](https://github.com/extrawurst/gitui/issues/748))
- filetree collapsing broken on windows ([#761](https://github.com/extrawurst/gitui/issues/761))

### Internal
- use git_repository_message [[@kosayoda](https://github.com/kosayoda)] ([#751](https://github.com/extrawurst/gitui/issues/751))
Expand Down
3 changes: 0 additions & 3 deletions filetreelist/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ pub enum Error {
#[error("InvalidPath: `{0}`")]
InvalidPath(PathBuf),

#[error("InvalidFilePath: `{0}`")]
InvalidFilePath(String),

#[error("TryFromInt error:{0}")]
IntConversion(#[from] TryFromIntError),
}
Expand Down
34 changes: 17 additions & 17 deletions filetreelist/src/filetree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{
error::Result, filetreeitems::FileTreeItems,
tree_iter::TreeIterator, TreeItemInfo,
};
use std::{collections::BTreeSet, usize};
use std::{collections::BTreeSet, path::Path, usize};

///
#[derive(Copy, Clone, Debug)]
Expand Down Expand Up @@ -35,7 +35,7 @@ pub struct FileTree {
impl FileTree {
///
pub fn new(
list: &[&str],
list: &[&Path],
collapsed: &BTreeSet<&String>,
) -> Result<Self> {
let mut new_self = Self {
Expand Down Expand Up @@ -318,12 +318,12 @@ impl FileTree {
mod test {
use crate::{FileTree, MoveSelection};
use pretty_assertions::assert_eq;
use std::collections::BTreeSet;
use std::{collections::BTreeSet, path::Path};

#[test]
fn test_selection() {
let items = vec![
"a/b", //
Path::new("a/b"), //
];

let mut tree =
Expand All @@ -341,8 +341,8 @@ mod test {
#[test]
fn test_selection_skips_collapsed() {
let items = vec![
"a/b/c", //
"a/d", //
Path::new("a/b/c"), //
Path::new("a/d"), //
];

//0 a/
Expand All @@ -364,8 +364,8 @@ mod test {
#[test]
fn test_selection_left_collapse() {
let items = vec![
"a/b/c", //
"a/d", //
Path::new("a/b/c"), //
Path::new("a/d"), //
];

//0 a/
Expand All @@ -390,8 +390,8 @@ mod test {
#[test]
fn test_selection_left_parent() {
let items = vec![
"a/b/c", //
"a/d", //
Path::new("a/b/c"), //
Path::new("a/d"), //
];

//0 a/
Expand All @@ -417,8 +417,8 @@ mod test {
#[test]
fn test_selection_right_expand() {
let items = vec![
"a/b/c", //
"a/d", //
Path::new("a/b/c"), //
Path::new("a/d"), //
];

//0 a/
Expand Down Expand Up @@ -449,8 +449,8 @@ mod test {
#[test]
fn test_selection_top() {
let items = vec![
"a/b/c", //
"a/d", //
Path::new("a/b/c"), //
Path::new("a/d"), //
];

//0 a/
Expand All @@ -470,9 +470,9 @@ mod test {
#[test]
fn test_visible_selection() {
let items = vec![
"a/b/c", //
"a/b/c2", //
"a/d", //
Path::new("a/b/c"), //
Path::new("a/b/c2"), //
Path::new("a/d"), //
];

//0 a/
Expand Down
Loading