cargo package --list
shows different whether .git
is present or not
#13691
Labels
A-git
Area: anything dealing with git
C-bug
Category: bug
Command-package
S-needs-team-input
Status: Needs input from team on whether/how to proceed.
Problem
cargo package --list
behavior is inconsistent:.git
is present, then it contains files starting with.
(i.e. hidden files).git
is not present, then it doesn't contain hidden filesSteps
cargo new hello
cd hello
touch .emptyfile
optional step to show that even hidden files unrelated to git are ignoredgit add . && git commit -m "init"
cargo package --list
As you can see, hidden files are present in the output. Now let's remove the git directory.
rm -rf .git
cargo package --list
I would expect the output of the two commands to be the same. Why do we ignore hidden files if
.git
is not present? It is confusing.Possible Solution(s)
Always include hidden files, even if
.git
is not present. I.e. don't differentiate between the two cases (.git present and not present): the behavior should be the same.Notes
I care about this because, for release-plz, I need to compare the git repository with the crate downloaded from the cargo registry, which doesn't contain the
.git
directory. I usecargo package --list
to compare if the two versions of the crate are the same.As a workaround I'm thinking of running
git init && git add . && git commit "init"
in the crate downloaded from the registry, so that the outcome ofcargo package --list
is the same.Version
The text was updated successfully, but these errors were encountered: