hercules-ci / gitignore.nix

Nix functions for filtering local git sources
The Unlicense
242 stars 19 forks source link

File being ignored even though it's committed #66

Open someplaceguy opened 6 months ago

someplaceguy commented 6 months ago

If you have a git repository that contains a file that is committed but matches a .gitignore rule, it will be checked out by git but not by gitignore.nix.

Example repository:

git init test
cd test
mkdir dir
touch dir/file
git add dir/file
git commit -m test
echo 'dir/*' > .gitignore
git add .gitignore
git commit -m test2

If you clone this repository with git, dir/file will be checked out inside the cloned repo.

However, if you use gitignore.nix, it will filter dir/file, thus resulting in what appears to be an empty repository...

someplaceguy commented 6 months ago

Ah, I see this might already be mentioned as missing functionality in the README file, specifically in the table with the row "Includes added but ignored files" (although I think "added" is not exactly the same as "committed" AFAIU).

Anyway, feel free to close this issue if you'd like.

roberth commented 6 months ago

It's a valid issue, and I think it should be resolved when Nix provides a sufficiently lazy fetching functionality, such as an alternative to. Not really blocked on the literal issue, but I'll link it as

More specifically it needs a non-experimental and lazy fetchTree for type = "git"; (mentioned in aforementioned issue). Related milestone: