Skip to content

Commit 2705679

Browse files
committed
fix release build
1 parent e02a4ab commit 2705679

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

git-worktree/src/fs/cache.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,16 @@ impl Cache {
124124
test_mkdir_calls,
125125
unlink_on_collision,
126126
attributes_file: _,
127-
} => create_leading_directory(components, stack, mode, test_mkdir_calls, *unlink_on_collision)?,
127+
} => {
128+
#[cfg(debug_assertions)]
129+
{
130+
create_leading_directory(components, stack, mode, test_mkdir_calls, *unlink_on_collision)?
131+
}
132+
#[cfg(not(debug_assertions))]
133+
{
134+
create_leading_directory(components, stack, mode, *unlink_on_collision)?
135+
}
136+
}
128137
Mode::ProvideAttributesAndIgnore { .. } => todo!(),
129138
}
130139
Ok(())
@@ -139,7 +148,7 @@ fn create_leading_directory(
139148
components: &mut std::iter::Peekable<std::path::Components<'_>>,
140149
stack: &Stack,
141150
mode: git_index::entry::Mode,
142-
mkdir_calls: &mut usize,
151+
#[cfg(debug_assertions)] mkdir_calls: &mut usize,
143152
unlink_on_collision: bool,
144153
) -> std::io::Result<()> {
145154
let target_is_dir = mode == git_index::entry::Mode::COMMIT || mode == git_index::entry::Mode::DIR;

0 commit comments

Comments
 (0)