Skip to content

Commit b2d63d3

Browse files
committed
fix: normalize path separators for custom ignore patterns on Windows
1 parent 3eb687f commit b2d63d3

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/lib.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -558,8 +558,13 @@ pub fn serialize_repo(
558558

559559
// Skip if matched by our ignore patterns
560560
let mut skip = false;
561+
#[cfg(windows)]
562+
let pattern_path = rel_str.replace('\\', "/");
563+
#[cfg(not(windows))]
564+
let pattern_path = rel_str.to_string();
565+
561566
for pat in &final_config.ignore_patterns {
562-
if pat.is_match(&rel_str) {
567+
if pat.is_match(&pattern_path) {
563568
debug!("Skipping {} - matched ignore pattern", rel_str);
564569
skip = true;
565570
break;
@@ -571,14 +576,14 @@ pub fn serialize_repo(
571576

572577
// Calculate priority score
573578
let mut priority = get_file_priority(
574-
&rel_str,
579+
&pattern_path,
575580
&final_config.ignore_patterns,
576581
&final_config.priority_list,
577582
);
578583

579584
// Boost priority for recently modified files
580585
if let Some(ref times) = commit_times {
581-
if let Some(ts) = times.get(&rel_str.to_string()) {
586+
if let Some(ts) = times.get(&pattern_path) {
582587
let now = SystemTime::now()
583588
.duration_since(UNIX_EPOCH)
584589
.unwrap_or_else(|_| Duration::from_secs(0))

0 commit comments

Comments
 (0)