Skip to content

Commit f1d04aa

Browse files
committed
🐛 Fix file content handling for deleted files
Fix error handling in file content display and simplify review UI In prompt.rs: - Add explicit handling for deleted files in change indicator logic - Improve error handling with expect message for file content access In review.rs: - Remove unused colored import - Simplify output display by removing conditional print logic - Remove decorative emoji and styling from review output - Fix unused parameter warning by renaming to _print
1 parent ee9de53 commit f1d04aa

File tree

2 files changed

+7
-17
lines changed

2 files changed

+7
-17
lines changed

src/commit/prompt.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,14 +240,16 @@ fn format_detailed_changes(
240240
let change_indicator = match file.change_type {
241241
ChangeType::Added => "➕",
242242
ChangeType::Modified => "✏️",
243-
_ => "",
243+
ChangeType::Deleted => "",
244244
};
245245

246246
format!(
247247
"{} File: {}\nFull File Content:\n{}\n\n--- End of File ---",
248248
change_indicator,
249249
file.path,
250-
file.content.as_ref().unwrap()
250+
file.content
251+
.as_ref()
252+
.expect("File content should be present for added/modified files")
251253
)
252254
})
253255
.collect::<Vec<_>>()

src/commit/review.rs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ use crate::instruction_presets::PresetType;
55
use crate::messages;
66
use crate::ui;
77
use anyhow::{Context, Result};
8-
use colored::Colorize;
98
use std::sync::Arc;
109

1110
/// Handles the review command which generates an AI code review of staged changes
12-
pub async fn handle_review_command(common: CommonParams, print: bool) -> Result<()> {
11+
pub async fn handle_review_command(common: CommonParams, _print: bool) -> Result<()> {
1312
// Check if the preset is appropriate for code reviews
1413
if !common.is_valid_preset_for_type(PresetType::Review) {
1514
ui::print_warning(
@@ -63,7 +62,7 @@ pub async fn handle_review_command(common: CommonParams, print: bool) -> Result<
6362
// Create and start the spinner
6463
let spinner = ui::create_spinner("");
6564
let random_message = messages::get_waiting_message();
66-
spinner.set_message(format!("{} {}", "🔮".cyan(), random_message.text));
65+
spinner.set_message(random_message.text);
6766

6867
// Generate the code review
6968
let review = service
@@ -74,18 +73,7 @@ pub async fn handle_review_command(common: CommonParams, print: bool) -> Result<
7473
spinner.finish_and_clear();
7574

7675
// Print the review to stdout or save to file if requested
77-
if print {
78-
// Just print to stdout
79-
println!("\n{}", review.format());
80-
} else {
81-
// Add a fancy version header
82-
println!(
83-
"\n{} {}\n",
84-
"🔮".cyan(),
85-
"Git-Iris Code Review".bright_magenta().bold()
86-
);
87-
println!("{}", review.format());
88-
}
76+
println!("{}", review.format());
8977

9078
Ok(())
9179
}

0 commit comments

Comments
 (0)