Skip to content

Commit a8b5751

Browse files
committed
fix: gix submodule list now prints the submodule path in debug mode
That way, special characters won't affect the terminal.
1 parent a773854 commit a8b5751

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

gitoxide-core/src/repository/submodule.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ fn print_sm(sm: Submodule<'_>, dirty_suffix: Option<&str>, out: &mut impl std::i
3131
}
3232
writeln!(
3333
out,
34-
" {is_active} {path} {config} head:{head_id} index:{index_id} ({worktree}) [{url}]",
34+
" {is_active} {path:?} {config} head:{head_id} index:{index_id} ({worktree}) [{url}]",
3535
is_active = if !sm.is_active()? || !state.repository_exists {
3636
"ⅹ"
3737
} else {
@@ -48,8 +48,8 @@ fn print_sm(sm: Submodule<'_>, dirty_suffix: Option<&str>, out: &mut impl std::i
4848
worktree = match sm_repo {
4949
Some(repo) => {
5050
// TODO(name-revision): this is the simple version, `git` gives it
51-
// multiple tries https://github.com/git/git/blob/fac96dfbb1c24369ba7d37a5affd8adfe6c650fd/builtin/submodule--helper.c#L161
52-
// and even uses `git name-rev`/`git describe --contains` which we can't do yet.
51+
// multiple tries https://github.com/git/git/blob/fac96dfbb1c24369ba7d37a5affd8adfe6c650fd/builtin/submodule--helper.c#L161
52+
// and even uses `git name-rev`/`git describe --contains` which we can't do yet.
5353
repo.head_commit()?
5454
.describe()
5555
.names(SelectRef::AllRefs)
@@ -60,7 +60,7 @@ fn print_sm(sm: Submodule<'_>, dirty_suffix: Option<&str>, out: &mut impl std::i
6060
.to_string()
6161
}
6262
None => {
63-
"no worktree".to_string()
63+
"no worktree".into()
6464
}
6565
},
6666
url = sm.url()?.to_bstring()

0 commit comments

Comments
 (0)