-
-
Notifications
You must be signed in to change notification settings - Fork 387
Open
Labels
acknowledgedan issue is accepted as shortcoming to be fixedan issue is accepted as shortcoming to be fixedhelp wantedExtra attention is neededExtra attention is needed
Description
Current behavior 😯
(version 0.70.0)
When a .git is not owned by the current user,
but is listed in safe.directories,
open(repo).remote_names() returns an empty list.
bail_if_untrusted(true) does not seem to make a difference.
See jj-vcs/jj#6155
Expected behavior 🤔
If the directory is in safe.directories, I'd expect it to be trusted.
Or, if gitoxide doesn't read safe.directories, I'd expect it to fail if bail_if_untrusted is set.
Git behavior
Git lists the remotes in both cases.
Steps to reproduce 🕹
git init owned; cd owned; git remote add origin https://github.com/GitoxideLabs/gitoxide; cd ..
git init non_owned; cd non_owned; git remote add origin https://github.com/GitoxideLabs/gitoxide; cd ..; sudo chown -R root non_owned
fn main() {
println!("using owned repo");
{
let repo_owned = gix::open("owned").expect("could not opon owned repo");
let rn = repo_owned.remote_names();
println!("found {} remotes", rn.len());
for remote in rn {
println!("remote: {}", remote);
}
}
println!("\n\n");
{
println!("using non-owned repo, which is in .gitconfig/safe.directories");
let repo_non_owned = gix::open("non_owned").expect("could not opon non-owned repo");
let rn = repo_non_owned.remote_names();
println!("found {} remotes", rn.len());
for remote in rn {
println!("remote: {}", remote);
}
}
println!("\n\n");
{
println!(
"using non-owned repo, which is in .gitconfig/safe.directories, + bail_if_untrusted"
);
let repo_non_owned =
gix::open_opts("non_owned", gix::open::Options::default().bail_if_untrusted(true))
.expect("could not opon non-owned repo wit bail-if-untrused");
let rn = repo_non_owned.remote_names();
println!("found {} remotes", rn.len());
for remote in rn {
println!("remote: {}", remote);
}
}
}
Metadata
Metadata
Assignees
Labels
acknowledgedan issue is accepted as shortcoming to be fixedan issue is accepted as shortcoming to be fixedhelp wantedExtra attention is neededExtra attention is needed