Should cargo bundle all local files when packaging a crate?

Yes having a warning when packaging files not tracked by git would be a good thing. But it would be specific to users who use git.

I like the solution proposed by @naicode, it would make sense to change the default behavior of Cargo for new projects to automatically add something like:

include = [
    "Cargo.toml",
    "README*",
    "LICENSE*",
    "src/**/*",
    "tests/**/*",
    "examples/**/*",
]

This requires no new features in Cargo, it would not be a breaking change as existing crates would not be affected.
I think this is a reasonable compromise, if the author wants stricter or looser inclusion rules he can modify his manifest to his needs.

1 Like