@@ -6,6 +6,7 @@ use gix::{
6
6
Progress ,
7
7
} ;
8
8
use gix_status:: index_as_worktree:: { traits:: FastEq , Change , Conflict , EntryStatus } ;
9
+ use std:: path:: { Path , PathBuf } ;
9
10
10
11
use crate :: OutputFormat ;
11
12
@@ -54,15 +55,19 @@ pub fn show(
54
55
gix:: worktree:: stack:: state:: attributes:: Source :: WorktreeThenIdMapping ,
55
56
) ?
56
57
. detach ( ) ;
57
- let pathspec = gix:: Pathspec :: new ( & repo, pathspecs. iter ( ) . map ( |p| p. as_bstr ( ) ) , true , || Ok ( stack. clone ( ) ) ) ?;
58
+ let pathspec = gix:: Pathspec :: new ( & repo, false , pathspecs. iter ( ) . map ( |p| p. as_bstr ( ) ) , true , || {
59
+ Ok ( stack. clone ( ) )
60
+ } ) ?;
58
61
let options = gix_status:: index_as_worktree:: Options {
59
62
fs : repo. filesystem_options ( ) ?,
60
63
thread_limit,
61
64
stat : repo. stat_options ( ) ?,
62
65
} ;
66
+ let prefix = repo. prefix ( ) ?. unwrap_or ( Path :: new ( "" ) ) ;
63
67
let mut printer = Printer {
64
68
out,
65
69
changes : Vec :: new ( ) ,
70
+ prefix : prefix. to_owned ( ) ,
66
71
} ;
67
72
let filter_pipeline = repo
68
73
. filter_pipeline ( Some ( gix:: hash:: ObjectId :: empty_tree ( repo. object_hash ( ) ) ) ) ?
@@ -87,15 +92,16 @@ pub fn show(
87
92
let repo = repo. clone ( ) . into_sync ( ) ;
88
93
let index = & index;
89
94
let collect = & mut collect;
90
- move || {
95
+ move || -> anyhow :: Result < _ > {
91
96
let repo = repo. to_thread_local ( ) ;
92
- repo. dirwalk (
97
+ let outcome = repo. dirwalk (
93
98
index,
94
99
pathspecs,
95
100
repo. dirwalk_options ( ) ?
96
101
. emit_untracked ( gix:: dir:: walk:: EmissionMode :: CollapseDirectory ) ,
97
102
collect,
98
- )
103
+ ) ?;
104
+ Ok ( outcome. dirwalk )
99
105
}
100
106
} ) ?;
101
107
@@ -125,7 +131,7 @@ pub fn show(
125
131
printer. out,
126
132
"{status: >3} {rela_path}" ,
127
133
status = "?" ,
128
- rela_path = entry. rela_path
134
+ rela_path = gix :: path :: relativize_with_prefix ( & gix :: path :: from_bstr ( entry. rela_path) , prefix ) . display ( )
129
135
) ?;
130
136
}
131
137
@@ -175,6 +181,7 @@ impl gix_status::index_as_worktree::traits::SubmoduleStatus for Submodule {
175
181
struct Printer < W > {
176
182
out : W ,
177
183
changes : Vec < ( usize , ApplyChange ) > ,
184
+ prefix : PathBuf ,
178
185
}
179
186
180
187
enum ApplyChange {
@@ -226,7 +233,9 @@ impl<W: std::io::Write> Printer<W> {
226
233
EntryStatus :: IntentToAdd => "A" ,
227
234
} ;
228
235
229
- writeln ! ( & mut self . out, "{status: >3} {rela_path}" )
236
+ let rela_path = gix:: path:: from_bstr ( rela_path) ;
237
+ let display_path = gix:: path:: relativize_with_prefix ( & rela_path, & self . prefix ) ;
238
+ writeln ! ( & mut self . out, "{status: >3} {}" , display_path. display( ) )
230
239
}
231
240
}
232
241
0 commit comments