File tree 2 files changed +17
-12
lines changed 2 files changed +17
-12
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
8
8
## Unreleased
9
9
10
+ ## Fixed
11
+ - wrong file with same name shown in file tree ([ #748 ] ( https://github.com/extrawurst/gitui/issues/748 ) )
12
+
10
13
## [ 0.16.0] - 2021-05-28
11
14
12
15
** merge branch, merge commit**
Original file line number Diff line number Diff line change @@ -148,20 +148,22 @@ impl RevisionFilesComponent {
148
148
149
149
fn selection_changed ( & mut self ) {
150
150
//TODO: retrieve TreeFile from tree datastructure
151
- if let Some ( file) = self . tree . selected_file ( ) . map ( |file| {
152
- file. full_path ( )
153
- . strip_prefix ( "./" )
154
- . unwrap_or_default ( )
155
- . to_string ( )
156
- } ) {
157
- if let Some ( item) = self
158
- . files
159
- . iter ( )
160
- . find ( |f| f. path . ends_with ( Path :: new ( & file) ) )
151
+ if let Some ( file) = self
152
+ . tree
153
+ . selected_file ( )
154
+ . map ( |file| file. full_path ( ) . to_string ( ) )
155
+ {
156
+ let path = Path :: new ( & file) ;
157
+ if let Some ( item) =
158
+ self . files . iter ( ) . find ( |f| f. path == path)
161
159
{
162
- self . current_file . load_file ( file, item) ;
160
+ if let Ok ( path) = path. strip_prefix ( "./" ) {
161
+ return self . current_file . load_file (
162
+ path. to_string_lossy ( ) . to_string ( ) ,
163
+ item,
164
+ ) ;
165
+ }
163
166
}
164
- } else {
165
167
self . current_file . clear ( ) ;
166
168
}
167
169
}
You can’t perform that action at this time.
0 commit comments