gitbutler icon indicating copy to clipboard operation
gitbutler copied to clipboard

Can not add project with git-ignored unowned files/folders

Open NobbZ opened this issue 1 year ago • 9 comments

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.

NobbZ avatar Feb 14 '24 11:02 NobbZ

can confirm, have the same issue

alexgherman avatar Feb 23 '24 16:02 alexgherman

Having the same Problem with my Dev-Container.

Mekcyed avatar Feb 26 '24 13:02 Mekcyed

Can confirm, same issue

jibon0070 avatar Feb 27 '24 20:02 jibon0070

The same. :cry:

Vishtar avatar Mar 05 '24 13:03 Vishtar

any update on it?

jibon0070 avatar Apr 19 '24 21:04 jibon0070

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?

Byron avatar Apr 20 '24 06:04 Byron

This change should now be part of the 0.11.4 release

krlvi avatar Apr 23 '24 16:04 krlvi

(In case no error shows up nonetheless, this might be due to #3591)

Byron avatar Apr 23 '24 17:04 Byron

Hey @NobbZ, if you have time would you be able to check the latest release to see if this is still an issue?

krlvi avatar May 05 '24 18:05 krlvi

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 ;)

NobbZ avatar May 16 '24 06:05 NobbZ

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.

Byron avatar May 16 '24 09:05 Byron