Can not add project with git-ignored unowned files/folders
I have a project that contains a docker-compose.yaml which again uses volumes in the source tree.
Due to the nature of how those work, the owning UID/GID are not known to the host system and the current user does not have any permissions to read files or recurse folders.
The (sanitized) output of git-butler for that operation is the following:
2024-02-14T11:03:39.791046Z ERROR add_project: gitbutler-app/src/projects/commands.rs:75: failed to add project error=failed to open repository
Caused by:
0: failed to run initial flush
1: failed to build working directory tree
2: failed to build wd index
3: failed to working directory list files in /home/nmelzer/Projects/anonymous
4: IO error for operation on /home/nmelzer/Projects/anonymous/data/base_version: Permission denied (os error 13)
5: Permission denied (os error 13) path="/home/nmelzer/Projects/anonymous"
But:
$ cd /home/nmelzer/Projects/anonymous
$ rg data .gitignore
39:/data/
So git butler should not care for the folder or its contents. And it should probably ignore anything else that is git-ignored.
can confirm, have the same issue
Having the same Problem with my Dev-Container.
Can confirm, same issue
The same. :cry:
any update on it?
It seems that the error message originates in this function, which does indeed not respect .gitignore files.
From what I could gather, it is trying to build a git tree from a working tree (build_wd_tree_from_repo()), which probably should respect ignore files right away. It does try to do that later, but that is too late.
This could be fixed by using a dirwalk_iter() instead, at least in this case where a working tree is listed.
Once released, could you try again to see if it works for you?
This change should now be part of the 0.11.4 release
(In case no error shows up nonetheless, this might be due to #3591)
Hey @NobbZ, if you have time would you be able to check the latest release to see if this is still an issue?
The original issue doesn't seem to happen anymore and I was able to open GB on that project as well as play a bit with the virtual branch.
I did not have the time for thorough testing, and until I got a better feeling for how GB works, I will not use it on that repo again. I lost some changes I did before testing this. This particular changes haven't been a big deal, though I have to learn GB in a less critical project first ;)
I am glad to hear the original issue was fixed, and sad you are among those who have suffered data-loss :/! Maybe this document on recovery can help if it still matters.
Meanwhile, let's close this issue for now, but reopen or add comments if it turns out to not actually be fixed.