mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00

### What does this PR try to resolve? If a there is a symlink into a git repository/submodule, when checking its git status with the wrong outer repo, we'll get an NotFound error, as the object doesn't belong to the outer repository. This kind of error blocked the entire `cargo package` operation. This fix additionally discovers the nearest Git repository, and then checks status with that, assuming the repo is the parent of the source file of the symlink. This is a best effort solution, so if the check fails we ignore. ### How should we test and review this PR? If we don't want the complication, we could drop the last commit, ignore the error, and forget about handling submodules fixes #15384 fixes #15413