{"id":15663274,"url":"https://github.com/mokeyish/cargo-patch-crate","last_synced_at":"2025-04-07T17:07:46.267Z","repository":{"id":203960424,"uuid":"710807678","full_name":"mokeyish/cargo-patch-crate","owner":"mokeyish","description":"Fix broken crates instantly 🏃🏽‍♀️💨","archived":false,"fork":false,"pushed_at":"2025-03-09T06:58:15.000Z","size":47,"stargazers_count":28,"open_issues_count":2,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-31T16:15:07.148Z","etag":null,"topics":["cargo-patch","crate","patch","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mokeyish.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-27T13:35:46.000Z","updated_at":"2025-03-26T08:20:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"ceb74124-fb53-4805-a93c-241e29fdebf5","html_url":"https://github.com/mokeyish/cargo-patch-crate","commit_stats":{"total_commits":16,"total_committers":3,"mean_commits":5.333333333333333,"dds":0.1875,"last_synced_commit":"ce7681b0bee84a8ca51927c6389f4a8223d70e08"},"previous_names":["mokeyish/patch-crate","mokeyish/cargo-patch-crate"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mokeyish%2Fcargo-patch-crate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mokeyish%2Fcargo-patch-crate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mokeyish%2Fcargo-patch-crate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mokeyish%2Fcargo-patch-crate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mokeyish","download_url":"https://codeload.github.com/mokeyish/cargo-patch-crate/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247694875,"owners_count":20980733,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cargo-patch","crate","patch","rust"],"created_at":"2024-10-03T13:36:18.109Z","updated_at":"2025-04-07T17:07:46.221Z","avatar_url":"https://github.com/mokeyish.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Patch-Crate\n\n[![](https://img.shields.io/crates/v/patch-crate.svg)](https://crates.io/crates/patch-crate)\n\npatch-crate lets rust app developer instantly make and keep fixes to rust crate dependencies.\nIt's a vital band-aid for those of us living on the bleeding edge.\n\n```sh\n# fix a bug in one of your dependencies\nvim target/patch/brokencrate\n\n# run patch-crate to create a .patch file\ncargo patch-crate some-crate\n\n# commit the patch file to share the fix with your team\ngit add patches/some-crate+3.14.15.patch\ngit commit -m \"fix broken_file.rs in some-crate\"\n```\n\nCheckout our example at [here](https://github.com/mokeyish/cargo-patch-crate-example).\n\n## Get started\n\n1. Install command `patch-crate`\n\n   ```sh\n   cargo install patch-crate\n   ```\n\n2. Add broken crate in your Cargo.toml\n\n   ```toml\n\n   [package.metadata.patch]\n   crates = [\"some-crate\"]\n\n   [patch.crates-io]\n   some-crate = { path=\"./target/patch/some-crate-1.0.110\" }\n   ```\n\n3. Download the crate's source code into `target/patch`\n\n   ```sh\n   cargo patch-crate\n   ```\n\n4. Fix the broken code in `target/patch/some-crate` directly.\n\n5. Create a crate-patch\n\n   ```sh\n   cargo patch-crate some-crate\n   ```\n\n6. Commit the patch file to share the fix with your team\n\n   ```sh\n   git add patches/some-crate+1.0.110.patch\n   git commit -m \"fix broken-code in some-crate\"\n   ```\n\n7. Instead of running cargo patch-crate its also possible to add a build.rs file like this:\n\n   ```rust\n   fn main() {\n      println!(\"cargo:rerun-if-changed=Cargo.toml\");\n      patch_crate::run().expect(\"Failed while patching\");\n   }\n   ```\n\n   To make it work, add the patch-crate library to the build-dependencies\n   \n   ```toml\n   patch-crate = \"0.1\"\n   ```\n\n## Command explanation\n\n- `cargo patch-crate`\n   \n   Apply patch files in `./patches` to `./target/patch/crate-xxx` if it not exist.\n\n- `cargo patch-crate --force`\n\n   Clean up `./target/patch/` and apply patch files in `./patches` to `./target/patch/crate-xxx`.\n\n- `crate patch-crate \u003ccrate name1\u003e \u003ccrate name2\u003e ...`\n\n   Create patch file of specific crate from `./target/patch/crate-xxx` and save to `./patches`\n\n\n## Credits\n\n- [itmettkeDE/cargo-patch](https://github.com/itmettkeDE/cargo-patch)\n- [ds300/patch-package](https://github.com/ds300/patch-package)\n\n## License\n\nLicensed under either of\n\n- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or \u003chttps://www.apache.org/licenses/LICENSE-2.0\u003e)\n- MIT license ([LICENSE-MIT](LICENSE-MIT) or \u003chttps://opensource.org/licenses/MIT\u003e)\n\nat your option.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmokeyish%2Fcargo-patch-crate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmokeyish%2Fcargo-patch-crate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmokeyish%2Fcargo-patch-crate/lists"}