@@ -6,6 +6,7 @@ use gix::{
66 Progress ,
77} ;
88use gix_status:: index_as_worktree:: { traits:: FastEq , Change , Conflict , EntryStatus } ;
9+ use std:: path:: { Path , PathBuf } ;
910
1011use crate :: OutputFormat ;
1112
@@ -54,15 +55,19 @@ pub fn show(
5455 gix:: worktree:: stack:: state:: attributes:: Source :: WorktreeThenIdMapping ,
5556 ) ?
5657 . 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+ } ) ?;
5861 let options = gix_status:: index_as_worktree:: Options {
5962 fs : repo. filesystem_options ( ) ?,
6063 thread_limit,
6164 stat : repo. stat_options ( ) ?,
6265 } ;
66+ let prefix = repo. prefix ( ) ?. unwrap_or ( Path :: new ( "" ) ) ;
6367 let mut printer = Printer {
6468 out,
6569 changes : Vec :: new ( ) ,
70+ prefix : prefix. to_owned ( ) ,
6671 } ;
6772 let filter_pipeline = repo
6873 . filter_pipeline ( Some ( gix:: hash:: ObjectId :: empty_tree ( repo. object_hash ( ) ) ) ) ?
@@ -87,15 +92,16 @@ pub fn show(
8792 let repo = repo. clone ( ) . into_sync ( ) ;
8893 let index = & index;
8994 let collect = & mut collect;
90- move || {
95+ move || -> anyhow :: Result < _ > {
9196 let repo = repo. to_thread_local ( ) ;
92- repo. dirwalk (
97+ let outcome = repo. dirwalk (
9398 index,
9499 pathspecs,
95100 repo. dirwalk_options ( ) ?
96101 . emit_untracked ( gix:: dir:: walk:: EmissionMode :: CollapseDirectory ) ,
97102 collect,
98- )
103+ ) ?;
104+ Ok ( outcome. dirwalk )
99105 }
100106 } ) ?;
101107
@@ -125,7 +131,7 @@ pub fn show(
125131 printer. out,
126132 "{status: >3} {rela_path}" ,
127133 status = "?" ,
128- rela_path = entry. rela_path
134+ rela_path = gix :: path :: relativize_with_prefix ( & gix :: path :: from_bstr ( entry. rela_path) , prefix ) . display ( )
129135 ) ?;
130136 }
131137
@@ -175,6 +181,7 @@ impl gix_status::index_as_worktree::traits::SubmoduleStatus for Submodule {
175181struct Printer < W > {
176182 out : W ,
177183 changes : Vec < ( usize , ApplyChange ) > ,
184+ prefix : PathBuf ,
178185}
179186
180187enum ApplyChange {
@@ -226,7 +233,9 @@ impl<W: std::io::Write> Printer<W> {
226233 EntryStatus :: IntentToAdd => "A" ,
227234 } ;
228235
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( ) )
230239 }
231240}
232241
0 commit comments