@@ -307,14 +307,31 @@ get_profile_file() {
307307 local profile_dir=" $base_dir /profiles/$current_profile "
308308 local full_path=" $profile_dir /$file_path "
309309
310+ # Check for profile config first (needed for exclusion check)
311+ local profile_config=" $profile_dir /profile-config.yml"
312+
310313 # Check if file exists in current profile
311314 if [[ -f " $full_path " ]]; then
315+ # Check if this file is excluded (even in current profile)
316+ if [[ -f " $profile_config " ]]; then
317+ local excluded=" false"
318+ while read pattern; do
319+ if [[ -n " $pattern " ]] && match_pattern " $file_path " " $pattern " ; then
320+ excluded=" true"
321+ break
322+ fi
323+ done < <( get_yaml_array " $profile_config " " exclude_inherited_files" )
324+
325+ if [[ " $excluded " == " true" ]]; then
326+ echo " "
327+ return
328+ fi
329+ fi
312330 echo " $full_path "
313331 return
314332 fi
315333
316334 # Check for inheritance
317- local profile_config=" $profile_dir /profile-config.yml"
318335 if [[ ! -f " $profile_config " ]]; then
319336 # No profile config means this is likely the default profile
320337 echo " "
@@ -328,15 +345,16 @@ get_profile_file() {
328345 return
329346 fi
330347
331- # Check if file is excluded
332- local excluded=$( get_yaml_array " $profile_config " " exclude_inherited_files" | while read pattern; do
333- if match_pattern " $file_path " " $pattern " ; then
334- echo " yes"
348+ # Check if file is excluded during inheritance
349+ local excluded=" false"
350+ while read pattern; do
351+ if [[ -n " $pattern " ]] && match_pattern " $file_path " " $pattern " ; then
352+ excluded=" true"
335353 break
336354 fi
337- done)
355+ done < <( get_yaml_array " $profile_config " " exclude_inherited_files " )
338356
339- if [[ " $excluded " == " yes " ]]; then
357+ if [[ " $excluded " == " true " ]]; then
340358 echo " "
341359 return
342360 fi
@@ -424,12 +442,12 @@ get_profile_files() {
424442
425443 # Check if excluded
426444 excluded=" false"
427- echo " $excluded_patterns " | while read pattern; do
445+ while read pattern; do
428446 if [[ -n " $pattern " ]] && match_pattern " $relative_path " " $pattern " ; then
429447 excluded=" true"
430448 break
431449 fi
432- done
450+ done <<< " $excluded_patterns "
433451
434452 if [[ " $excluded " != " true" ]]; then
435453 # Check if already in list (override scenario)
0 commit comments