Cargo patch failed with error: Unable to parse patch file

I have a project which cargo patch works perfectly fine on one machine.
While recently I got a new dev machine and am trying to setup dev enviroment. Then I got issue to run Cargo patch, it returns

Error: Unable to parse patch file

version info:
cargo-patch v0.2.9
cargo 1.66.0
rustc 1.66.0

It also seems that Cargo patch does not download crate to target folder

The cause was because of line endings. The solution is to to change git setting.

git config --global core.autocrlf false

and checkout the repository again which fixed my issue.

cargo-patch could improve this case in fact.