Skip to content

is_path_ignored not working on windows #334

Closed
@Eh2406

Description

@Eh2406

steps to repro:
start a new cargo project C:\> cargo new git2-test then
check that .gitignore includes /target
add git2 = "*" to Cargo.toml and the following to main.rs

extern crate git2;

fn main() {
    let p_exe = std::env::current_exe().unwrap();
    println!("./target/debug == {:?}", p_exe.display());
    let repo = git2::Repository::discover(&p_exe).unwrap();
    println!("./.git == {:?}", repo.path().display());
    let ignored = repo.is_path_ignored(&p_exe).unwrap();
    println!("true == {:?}", ignored);
}

(or unzip the file git2-test.zip) and do cargo run.

output is:

C:\git2-test>cargo run
   Compiling git2-test v0.1.0 (file:///C:/git2-test)
    Finished dev [unoptimized + debuginfo] target(s) in 1.78s
     Running `target\debug\git2-test.exe`
./target/debug == "C:\\git2-test\\target\\debug\\git2-test.exe"
./.git == "C:/git2-test/.git/"
true == false

I expected the last line to be true == true

tested on windows 10 locally, reduced from appveyor testing rust-lang/cargo#5733

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions