Maybe something fixed?

This commit is contained in:
Bishoy Ehab
2025-10-17 14:13:16 +03:00
parent 4038c437c6
commit ca2d073775
+25 -3
View File
@@ -850,14 +850,13 @@ if [[ "$process_files" == true ]]; then
files_processed=0
files_updated=0
files_created=0
files_skipped=0
for dir_name in "${MONITOR_DIRS[@]}"; do
repo_dir_path="${REPO_DIR}/${dir_name}"
if [[ ! -d "$repo_dir_path" ]]; then
if [[ "$VERBOSE" == true ]]; then
log_warning "Skipping non-existent directory: $repo_dir_path"
fi
log_warning "Skipping non-existent directory: $repo_dir_path"
continue
fi
@@ -879,19 +878,35 @@ if [[ "$process_files" == true ]]; then
log_info "[DRY-RUN] Would create directory: $home_dir_path"
fi
# Debug: Check what files are found
if [[ "$VERBOSE" == true ]]; then
log_info "Looking for files in: $repo_dir_path"
fi
while IFS= read -r -d '' repo_file; do
# Calculate relative path from the repo source directory
rel_path="${repo_file#$repo_dir_path/}"
home_file="${home_dir_path}/${rel_path}"
if [[ "$VERBOSE" == true ]]; then
log_info "Checking file: $rel_path"
fi
if should_ignore "$home_file"; then
if [[ "$VERBOSE" == true ]]; then
log_info "Skipping ignored file: $home_file"
fi
((files_skipped++))
continue
fi
((files_processed++))
# Ensure parent directory exists
if [[ "$DRY_RUN" != true ]]; then
mkdir -p "$(dirname "$home_file")"
else
log_info "[DRY-RUN] Would create directory: $(dirname "$home_file")"
fi
if [[ -f "$home_file" ]]; then
@@ -901,14 +916,20 @@ if [[ "$process_files" == true ]]; then
log_warning "[DRY-RUN] Conflict detected (would prompt): $home_file"
((files_updated++))
else
log_info "Handling conflict for: $home_file"
handle_file_conflict "$repo_file" "$home_file"
((files_updated++))
fi
else
if [[ "$VERBOSE" == true ]]; then
log_info "No changes in: $rel_path"
fi
fi
else
if [[ "$DRY_RUN" == true ]]; then
log_info "[DRY-RUN] Would create new file: $home_file"
else
log_info "Creating new file: $home_file"
cp -p "$repo_file" "$home_file"
log_success "Created new file: $home_file"
fi
@@ -922,6 +943,7 @@ if [[ "$process_files" == true ]]; then
log_info "- Files processed: $files_processed"
log_info "- Files with conflicts: $files_updated"
log_info "- New files created: $files_created"
log_info "- Files skipped (ignored): $files_skipped"
else
log_info "Skipping file updates (no changes detected and not in force mode)"
fi