Skip to content

Commit 9728ef1

Browse files
committed
Fix list files
1 parent 10c29eb commit 9728ef1

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

moatless/actions/list_files.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,21 @@ async def execute(
166166
# Use grep to filter out target directory, then check each remaining directory
167167
if list_files_args.recursive:
168168
# Filter out the target directory upfront, then check git ignore status
169-
dirs_command = f"find {target_dir} -xdev -type d | grep -v '^{escaped_target_dir}$' | while read -r dir; do git check-ignore \"$dir/\" >/dev/null || echo \"$dir\"; done | sort"
169+
# Suppress stderr from git check-ignore to avoid fatal messages leaking into output
170+
dirs_command = (
171+
f"find {target_dir} -xdev -type d | "
172+
f"grep -v '^{escaped_target_dir}$' | "
173+
f"while read -r dir; do git check-ignore \"$dir/\" >/dev/null 2>&1 || echo \"$dir\"; done | sort"
174+
)
170175
if ignore_pattern:
171176
dirs_command += ignore_pattern
172177
else:
173-
dirs_command = f"find {target_dir} -xdev -maxdepth 1 -type d | grep -v '^{escaped_target_dir}$' | while read -r dir; do git check-ignore \"$dir/\" >/dev/null || echo \"$dir\"; done | sort"
178+
# Suppress stderr from git check-ignore to avoid fatal messages leaking into output
179+
dirs_command = (
180+
f"find {target_dir} -xdev -maxdepth 1 -type d | "
181+
f"grep -v '^{escaped_target_dir}$' | "
182+
f"while read -r dir; do git check-ignore \"$dir/\" >/dev/null 2>&1 || echo \"$dir\"; done | sort"
183+
)
174184
if ignore_pattern:
175185
dirs_command += ignore_pattern
176186
else:

0 commit comments

Comments
 (0)