You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've attached a minimal reproduction cargo-bug-test.zip. Download it and run the following commands.
unzip cargo-bug-test.zip
cd cargo-bug-test
git status
Verify that git status reports a clean directory. If not, then extracting the symlink out of the zip didnt' work. This might happen on Windows. I've only tested on Linux.
Note that there is a git repository at the root and in the-submodule. This makes the-submodule a submodule, even though it isn't specified by a git URL. I did it this way to get a self contained example. Usually you would have a submodule with URL. The bug is the same.
cargo +1.85 package -p workspace-crate succeeds.
cargo +1.86 package -p workspace-crate fails with this error:
error: attempt to get status of nonexistent file 'the-submodule/submodule-file'; class=Invalid (3); code=NotFound (-3)
The change behavior is caused by #14981 . The call repo.status_file(&rel_path) returns the error we see in the command line output. This could be a bug in Git2 or it could be that Cargo shouldn't pass submodule paths into Git2.
The text was updated successfully, but these errors were encountered:
### 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#15384fixes#15413
Uh oh!
There was an error while loading. Please reload this page.
I've attached a minimal reproduction cargo-bug-test.zip. Download it and run the following commands.
Verify that git status reports a clean directory. If not, then extracting the symlink out of the zip didnt' work. This might happen on Windows. I've only tested on Linux.
The folder structure looks like this:
Note that there is a git repository at the root and in
the-submodule
. This makesthe-submodule
a submodule, even though it isn't specified by a git URL. I did it this way to get a self contained example. Usually you would have a submodule with URL. The bug is the same.cargo +1.85 package -p workspace-crate
succeeds.cargo +1.86 package -p workspace-crate
fails with this error:The change behavior is caused by #14981 . The call
repo.status_file(&rel_path)
returns the error we see in the command line output. This could be a bug in Git2 or it could be that Cargo shouldn't pass submodule paths into Git2.The text was updated successfully, but these errors were encountered: