gitbutlerapp / gitbutler

The GitButler version control client, backed by Git, powered by Tauri/Rust/Svelte
https://gitbutler.com
Other
12.37k stars 486 forks source link

Windows access denied errors/gitbutler deleting files #3560

Open slingshotvfx opened 4 months ago

slingshotvfx commented 4 months ago

gitbutler 0.11.3 for windows very often has issues with locked files/access denied errors on my machine. Running windows 11.

When these errors pop up, it permanently deletes the file(s) that were erroring, resulting in a loss of data.

This might be a dupe of https://github.com/gitbutlerapp/gitbutler/issues/3412, but I'm opening a new issue because I have no explorer windows, command prompts, or VS Code instances open, and file locksmith shows no handles/processes with locks on the files that show up in the error logs.

Is it possible gitbutler is locking/blocking it's own access to files somehow?

Here's an example:

deleting a branch after it's merged

image

2024-04-19T18:57:25.479384Z  INFO delete_virtual_branch: crates\gitbutler-tauri\src\virtual_branches.rs:187: new project_id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 branch_id=e2091767-34d4-4403-916a-94caf37b4eb8
2024-04-19T18:57:25.538656Z  INFO delete_virtual_branch:workdir: crates\gitbutler-core\src\git\diff.rs:68: new project_id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 branch_id=e2091767-34d4-4403-916a-94caf37b4eb8 commit_oid=Oid { oid: be8e297f54ff1f903bf8a77df586bf956d68fd0f }
2024-04-19T18:57:25.585488Z  INFO delete_virtual_branch:workdir: crates\gitbutler-core\src\git\diff.rs:68: close time.busy=46.8ms time.idle=39.0µs project_id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 branch_id=e2091767-34d4-4403-916a-94caf37b4eb8 commit_oid=Oid { oid: be8e297f54ff1f903bf8a77df586bf956d68fd0f }
2024-04-19T18:57:25.635546Z  INFO set_project_active:watch:file monitor:handle debounced events: crates\gitbutler-watcher\src\file_monitor.rs:77: new id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 project_id=6d2a9edb-768a-4d6c-b165-31ace816c5a9
2024-04-19T18:57:25.636973Z  INFO set_project_active:watch:file monitor:handle debounced events: crates\gitbutler-watcher\src\file_monitor.rs:77: close time.busy=1.40ms time.idle=31.9µs id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 project_id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 fs_events=12 fs_events=12 ignored=0 ignored=0 git_noop=11 git_noop=11 git=1 git=1 project=0 project=0 git_dedup=1 git_dedup=1
2024-04-19T18:57:25.637165Z  INFO handle: crates\gitbutler-watcher\src\handler.rs:73: new event=GitFileChange(6d2a9edb-768a-4d6c-b165-31ace816c5a9, logs\HEAD)
2024-04-19T18:57:25.637837Z  INFO handle: crates\gitbutler-watcher\src\handler.rs:73: close time.busy=652µs time.idle=34.9µs event=GitFileChange(6d2a9edb-768a-4d6c-b165-31ace816c5a9, logs\HEAD)
2024-04-19T18:57:25.664806Z  INFO set_project_active:watch:file monitor:handle debounced events: crates\gitbutler-watcher\src\file_monitor.rs:77: new id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 project_id=6d2a9edb-768a-4d6c-b165-31ace816c5a9
2024-04-19T18:57:25.666269Z  INFO set_project_active:watch:file monitor:handle debounced events: crates\gitbutler-watcher\src\file_monitor.rs:77: close time.busy=1.44ms time.idle=29.2µs id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 project_id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 fs_events=56 fs_events=56 ignored=0 ignored=0 git_noop=53 git_noop=53 git=2 git=2 project=0 project=0 git_dedup=2 git_dedup=2
2024-04-19T18:57:25.666320Z  INFO handle: crates\gitbutler-watcher\src\handler.rs:73: new event=GitFileChange(6d2a9edb-768a-4d6c-b165-31ace816c5a9, index, logs\HEAD)
2024-04-19T18:57:25.666737Z  INFO handle: crates\gitbutler-watcher\src\handler.rs:73: close time.busy=402µs time.idle=18.3µs event=GitFileChange(6d2a9edb-768a-4d6c-b165-31ace816c5a9, index, logs\HEAD)
2024-04-19T18:57:25.690696Z  INFO set_project_active:watch:file monitor:handle debounced events: crates\gitbutler-watcher\src\file_monitor.rs:77: new id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 project_id=6d2a9edb-768a-4d6c-b165-31ace816c5a9
2024-04-19T18:57:25.692465Z  INFO set_project_active:watch:file monitor:handle debounced events: crates\gitbutler-watcher\src\file_monitor.rs:77: close time.busy=1.74ms time.idle=35.0µs id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 project_id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 fs_events=5 fs_events=5 ignored=0 ignored=0 git_noop=5 git_noop=5 git=0 git=0 project=0 project=0
2024-04-19T18:57:25.701038Z ERROR delete_virtual_branch: crates\gitbutler-tauri\src\virtual_branches.rs:187: error=Error(failed to checkout tree

Caused by:
    failed rmdir - 'C:/Users/<redacted>/Documents/main/backend/app/adapters/' is locked: Access is denied.
    ; class=Os (2); code=Locked (-14)) project_id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 branch_id=e2091767-34d4-4403-916a-94caf37b4eb8
2024-04-19T18:57:25.701049Z  INFO delete_virtual_branch: crates\gitbutler-tauri\src\virtual_branches.rs:187: close time.busy=222ms time.idle=36.5µs project_id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 branch_id=e2091767-34d4-4403-916a-94caf37b4eb8
2024-04-19T18:57:25.702048Z  INFO list_remote_branches: crates\gitbutler-tauri\src\virtual_branches.rs:379: new project_id=6d2a9edb-768a-4d6c-b165-31ace816c5a9
2024-04-19T18:57:25.708571Z  INFO list_remote_branches: crates\gitbutler-tauri\src\virtual_branches.rs:379: close time.busy=6.51ms time.idle=21.6µs project_id=6d2a9edb-768a-4d6c-b165-31ace816c5a9
2024-04-19T18:57:25.715917Z  INFO set_project_active:watch:file monitor:handle debounced events: crates\gitbutler-watcher\src\file_monitor.rs:77: new id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 project_id=6d2a9edb-768a-4d6c-b165-31ace816c5a9
2024-04-19T18:57:25.717136Z  INFO set_project_active:watch:file monitor:handle debounced events: crates\gitbutler-watcher\src\file_monitor.rs:77: close time.busy=1.20ms time.idle=22.6µs id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 project_id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 fs_events=33 fs_events=33 ignored=0 ignored=0 git_noop=33 git_noop=33 git=0 git=0 project=0 project=0
2024-04-19T18:57:25.741342Z  INFO set_project_active:watch:file monitor:handle debounced events: crates\gitbutler-watcher\src\file_monitor.rs:77: new id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 project_id=6d2a9edb-768a-4d6c-b165-31ace816c5a9
2024-04-19T18:57:25.743345Z  INFO set_project_active:watch:file monitor:handle debounced events: crates\gitbutler-watcher\src\file_monitor.rs:77: close time.busy=1.98ms time.idle=34.1µs id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 project_id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 fs_events=3 fs_events=3 ignored=0 ignored=0 git_noop=3 git_noop=3 git=0 git=0 project=0 project=0
2024-04-19T18:57:25.766865Z  INFO set_project_active:watch:file monitor:handle debounced events: crates\gitbutler-watcher\src\file_monitor.rs:77: new id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 project_id=6d2a9edb-768a-4d6c-b165-31ace816c5a9
2024-04-19T18:57:25.768067Z  INFO set_project_active:watch:file monitor:handle debounced events: crates\gitbutler-watcher\src\file_monitor.rs:77: close time.busy=1.19ms time.idle=22.8µs id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 project_id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 fs_events=18 fs_events=18 ignored=0 ignored=0 git_noop=18 git_noop=18 git=0 git=0 project=0 project=0
2024-04-19T18:57:25.791971Z  INFO set_project_active:watch:file monitor:handle debounced events: crates\gitbutler-watcher\src\file_monitor.rs:77: new id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 project_id=6d2a9edb-768a-4d6c-b165-31ace816c5a9
2024-04-19T18:57:25.795832Z  INFO set_project_active:watch:file monitor:handle debounced events: crates\gitbutler-watcher\src\file_monitor.rs:77: close time.busy=3.82ms time.idle=54.5µs id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 project_id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 fs_events=17 fs_events=17 ignored=0 ignored=0 git_noop=17 git_noop=17 git=0 git=0 project=0 project=0
2024-04-19T18:57:25.817632Z  INFO set_project_active:watch:file monitor:handle debounced events: crates\gitbutler-watcher\src\file_monitor.rs:77: new id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 project_id=6d2a9edb-768a-4d6c-b165-31ace816c5a9
2024-04-19T18:57:25.821797Z  INFO set_project_active:watch:file monitor:handle debounced events: crates\gitbutler-watcher\src\file_monitor.rs:77: close time.busy=4.13ms time.idle=55.0µs id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 project_id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 fs_events=27 fs_events=27 ignored=0 ignored=0 git_noop=25 git_noop=25 git=0 git=0 project=2 project=2 project_dedup=2 project_dedup=2
2024-04-19T18:57:25.821858Z  INFO handle: crates\gitbutler-watcher\src\handler.rs:73: new event=ProjectFileChange(6d2a9edb-768a-4d6c-b165-31ace816c5a9, backend\app\adapters\filesystem.py, backend\app\adapters)
2024-04-19T18:57:25.821876Z  INFO handle:recalculate_everything: crates\gitbutler-watcher\src\handler.rs:287: new event=ProjectFileChange(6d2a9edb-768a-4d6c-b165-31ace816c5a9, backend\app\adapters\filesystem.py, backend\app\adapters) paths=2
2024-04-19T18:57:25.821952Z  INFO handle:recalculate_everything:calculate_virtual_branches: crates\gitbutler-watcher\src\handler.rs:172: new event=ProjectFileChange(6d2a9edb-768a-4d6c-b165-31ace816c5a9, backend\app\adapters\filesystem.py, backend\app\adapters) paths=2
2024-04-19T18:57:25.822074Z  INFO handle:recalculate_everything:calculate_deltas: crates\gitbutler-watcher\src\handler\calculate_deltas.rs:11: new event=ProjectFileChange(6d2a9edb-768a-4d6c-b165-31ace816c5a9, backend\app\adapters\filesystem.py, backend\app\adapters) paths=2
2024-04-19T18:57:25.849488Z  INFO handle:recalculate_everything:calculate_deltas: crates\gitbutler-watcher\src\handler\calculate_deltas.rs:11: close time.busy=27.4ms time.idle=52.5µs event=ProjectFileChange(6d2a9edb-768a-4d6c-b165-31ace816c5a9, backend\app\adapters\filesystem.py, backend\app\adapters) paths=2
2024-04-19T18:57:25.865405Z  INFO handle:recalculate_everything:calculate_virtual_branches:workdir: crates\gitbutler-core\src\git\diff.rs:68: new event=ProjectFileChange(6d2a9edb-768a-4d6c-b165-31ace816c5a9, backend\app\adapters\filesystem.py, backend\app\adapters) paths=2 commit_oid=Oid { oid: 3c10d56378000f4b9a3110707e3830ccfbfa95ab }
2024-04-19T18:57:25.899961Z  INFO handle:recalculate_everything:calculate_virtual_branches:workdir: crates\gitbutler-core\src\git\diff.rs:68: close time.busy=34.5ms time.idle=35.2µs event=ProjectFileChange(6d2a9edb-768a-4d6c-b165-31ace816c5a9, backend\app\adapters\filesystem.py, backend\app\adapters) paths=2 commit_oid=Oid { oid: 3c10d56378000f4b9a3110707e3830ccfbfa95ab }
2024-04-19T18:57:25.959321Z  INFO set_project_active:watch:file monitor:handle debounced events: crates\gitbutler-watcher\src\file_monitor.rs:77: new id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 project_id=6d2a9edb-768a-4d6c-b165-31ace816c5a9
2024-04-19T18:57:25.960655Z  INFO set_project_active:watch:file monitor:handle debounced events: crates\gitbutler-watcher\src\file_monitor.rs:77: close time.busy=1.31ms time.idle=29.0µs id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 project_id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 fs_events=15 fs_events=15 ignored=0 ignored=0 git_noop=13 git_noop=13 git=2 git=2 project=0 project=0 git_dedup=2 git_dedup=2
2024-04-19T18:57:25.960700Z  INFO handle: crates\gitbutler-watcher\src\handler.rs:73: new event=GitFileChange(6d2a9edb-768a-4d6c-b165-31ace816c5a9, logs\HEAD, index)
2024-04-19T18:57:25.961108Z  INFO handle: crates\gitbutler-watcher\src\handler.rs:73: close time.busy=396µs time.idle=17.7µs event=GitFileChange(6d2a9edb-768a-4d6c-b165-31ace816c5a9, logs\HEAD, index)
2024-04-19T18:57:25.974649Z  INFO handle:recalculate_everything:calculate_virtual_branches: crates\gitbutler-watcher\src\handler.rs:172: close time.busy=153ms time.idle=21.3µs event=ProjectFileChange(6d2a9edb-768a-4d6c-b165-31ace816c5a9, backend\app\adapters\filesystem.py, backend\app\adapters) paths=2
2024-04-19T18:57:25.974660Z  INFO handle:recalculate_everything: crates\gitbutler-watcher\src\handler.rs:287: close time.busy=153ms time.idle=9.60µs event=ProjectFileChange(6d2a9edb-768a-4d6c-b165-31ace816c5a9, backend\app\adapters\filesystem.py, backend\app\adapters) paths=2
2024-04-19T18:57:25.974679Z ERROR handle: crates\gitbutler-watcher\src\handler.rs:73: error=failed to get file content

Caused by:
    io error: Access is denied. (os error 5) event=ProjectFileChange(6d2a9edb-768a-4d6c-b165-31ace816c5a9, backend\app\adapters\filesystem.py, backend\app\adapters)
2024-04-19T18:57:25.974685Z  INFO handle: crates\gitbutler-watcher\src\handler.rs:73: close time.busy=153ms time.idle=22.0µs event=ProjectFileChange(6d2a9edb-768a-4d6c-b165-31ace816c5a9, backend\app\adapters\filesystem.py, backend\app\adapters)
2024-04-19T18:57:25.978480Z  INFO can_apply_virtual_branch: crates\gitbutler-tauri\src\virtual_branches.rs:290: new project_id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 branch_id=82fc9571-c29f-4a7d-bd1b-c644134034c4
2024-04-19T18:57:25.978487Z  INFO can_apply_virtual_branch: crates\gitbutler-tauri\src\virtual_branches.rs:290: new project_id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 branch_id=2e275aa0-1e16-4b15-a241-4f159ef2eb15
2024-04-19T18:57:25.978517Z  INFO can_apply_virtual_branch: crates\gitbutler-tauri\src\virtual_branches.rs:290: new project_id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 branch_id=fd7ab312-71ae-40ab-bcb1-93ceba44d129
2024-04-19T18:57:25.978535Z  INFO can_apply_virtual_branch: crates\gitbutler-tauri\src\virtual_branches.rs:290: new project_id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 branch_id=8f8137df-d046-4d63-b7ce-c304c708c15d
2024-04-19T18:57:25.978551Z  INFO can_apply_virtual_branch: crates\gitbutler-tauri\src\virtual_branches.rs:290: new project_id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 branch_id=e2091767-34d4-4403-916a-94caf37b4eb8
2024-04-19T18:57:25.984450Z  INFO set_project_active:watch:file monitor:handle debounced events: crates\gitbutler-watcher\src\file_monitor.rs:77: new id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 project_id=6d2a9edb-768a-4d6c-b165-31ace816c5a9
2024-04-19T18:57:25.985730Z  INFO can_apply_virtual_branch: crates\gitbutler-tauri\src\virtual_branches.rs:290: close time.busy=7.23ms time.idle=20.8µs project_id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 branch_id=2e275aa0-1e16-4b15-a241-4f159ef2eb15
2024-04-19T18:57:25.987002Z  INFO set_project_active:watch:file monitor:handle debounced events: crates\gitbutler-watcher\src\file_monitor.rs:77: close time.busy=2.52ms time.idle=37.3µs id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 project_id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 fs_events=13 fs_events=13 ignored=0 ignored=0 git_noop=12 git_noop=12 git=1 git=1 project=0 project=0 git_dedup=1 git_dedup=1
2024-04-19T18:57:25.987056Z  INFO handle: crates\gitbutler-watcher\src\handler.rs:73: new event=GitFileChange(6d2a9edb-768a-4d6c-b165-31ace816c5a9, index)
2024-04-19T18:57:25.987838Z  INFO can_apply_virtual_branch: crates\gitbutler-tauri\src\virtual_branches.rs:290: close time.busy=9.34ms time.idle=31.2µs project_id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 branch_id=82fc9571-c29f-4a7d-bd1b-c644134034c4
2024-04-19T18:57:25.987875Z  INFO handle: crates\gitbutler-watcher\src\handler.rs:73: close time.busy=802µs time.idle=22.5µs event=GitFileChange(6d2a9edb-768a-4d6c-b165-31ace816c5a9, index)
2024-04-19T18:57:25.992516Z  INFO can_apply_virtual_branch: crates\gitbutler-tauri\src\virtual_branches.rs:290: close time.busy=4.67ms time.idle=9.34ms project_id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 branch_id=fd7ab312-71ae-40ab-bcb1-93ceba44d129
2024-04-19T18:57:25.999472Z  INFO can_apply_virtual_branch: crates\gitbutler-tauri\src\virtual_branches.rs:290: close time.busy=6.93ms time.idle=14.0ms project_id=6d2a9edb-768a-4d6c-b165-31ace816c5a9 branch_id=8f8137df-d046-4d63-b7ce-c304c708c15d

In this example, filesystem.py was deleted and no longer exists on the disk.

There might actually be two issues here. I think the ERROR set_base_branch: crates\gitbutler-tauri\src\virtual_branches.rs:138: error=Error(failed to checkout tree call is destructively removing changed files before erroring and not putting them back. But I'm also not sure where the Access is denied error is coming from in the first place.

I've also experienced this same issue when unapplying branches, updating the workspace, and switching back to gitbutler (after checking out the main branch elsewhere)

Byron commented 4 months ago

Thanks so much for reporting! I am also very sorry to see that files were deleted, and hope that these docs on data recovery with GitButler can help getting them back. Unfortunately, I don't know much about how virtual branches are applied, and can't even theorise about possible causes for the data-loss described here.

But, having recently worked on the watcher part I can say that the theory of GB causing this itself seems likely.

After all, when files are changed, it will recalculate a lot of things and read files in the process. This happens in parallel to the ongoing changes in the working tree, preventing the removal of files.

In theory, filesystem events should be bundled into 100ms time-slices, but judging from the log this doesn't really happen here as these events are apparently more frequent than that. But even if it would work, then the changing operation could still not take longer than 100ms, or else the recalculation would already kick in. And even if this window would be larger than 100ms, there is always a chance that a change takes longer than that.

The only way to truly prevent 'stepping onto ones feet' is to assure reads are never interleaved with writes, something that cannot currently be done but of course is possible.

slingshotvfx commented 4 months ago

@Byron thanks for the link, fortunately I've not lost anything unrecoverable so far but I wasn't aware of that data recovery documentation which I'm sure will come in handy.

I'm not a rust guy but I'm happy to test future fixes or help in anyway I can.

Here's another person on discord with (possibly) the same issue causing problems with changes being locked: https://discord.com/channels/1060193121130000425/1206670506271707156/1230554414511689830

slingshotvfx commented 1 month ago

Just wanted to update this thread for newer builds. I find the latest version of gitbutler to be a lot more stable on windows, so really appreciate the effort there! Unfortunately I still run into this failed rmdir error and loss of data pretty regularly in gitbutler v0.12.9. Possibly the same or related to #3601

I captured the filesystem activity during these errors with ProcessMonitor. This was clicking the workspace "update" button after merging a simple PR in github. image

It seems gitbutler is deleting one particular file, \ingest\handler.py, then trying to delete the entire ingest folder, which fails (possibly because it's not empty, as there are lots of other files in there besides handler.py which was the only one deleted)

I am not familiar with the internals of gitbutler to understand why it needs to delete handler.py or the whole ingest folder. Do you have any ideas about why this is happening?

The update I'm trying to apply doesn't touch the ingest folder or handler.py at all (though handler.py does have uncommitted changes in another virtual branch) and there are no other attempts from gitbutler to delete any other files or folders in the entire repository.

The logs have changed slightly, the error now says failed to checkout index, this should not have happened, we should have already detected this, if that helps at all.

2024-07-12T00:29:54.581892Z  INFO update_base_branch: crates\gitbutler-tauri\src\virtual_branches.rs:152: new project_id=7954371c-c675-4582-b0d3-ec6d6201f378
2024-07-12T00:29:54.595111Z  INFO update_base_branch:create_snapshot: crates\gitbutler-oplog\src\oplog.rs:289: new project_id=7954371c-c675-4582-b0d3-ec6d6201f378 self=Project { id: 7954371c-c675-4582-b0d3-ec6d6201f378, title: "slingshot-main", description: None, path: "C:\\Users\\Geoff\\Documents\\slingshot-main", preferred_key: SystemExecutable, ok_with_force_push: true, api: None, gitbutler_data_last_fetch: None, gitbutler_code_push_state: None, project_data_last_fetch: Some(Fetched { timestamp: SystemTime { intervals: 133652176575391519 } }), omit_certificate_check: None, snapshot_lines_threshold: None, ignore_project_semaphore: false }
2024-07-12T00:29:54.668369Z  INFO update_base_branch:create_snapshot: crates\gitbutler-oplog\src\oplog.rs:289: close time.busy=73.2ms time.idle=28.1µs project_id=7954371c-c675-4582-b0d3-ec6d6201f378 self=Project { id: 7954371c-c675-4582-b0d3-ec6d6201f378, title: "slingshot-main", description: None, path: "C:\\Users\\Geoff\\Documents\\slingshot-main", preferred_key: SystemExecutable, ok_with_force_push: true, api: None, gitbutler_data_last_fetch: None, gitbutler_code_push_state: None, project_data_last_fetch: Some(Fetched { timestamp: SystemTime { intervals: 133652176575391519 } }), omit_certificate_check: None, snapshot_lines_threshold: None, ignore_project_semaphore: false }
2024-07-12T00:29:54.677097Z  INFO update_base_branch:workdir: crates\gitbutler-branch\src\diff.rs:150: new project_id=7954371c-c675-4582-b0d3-ec6d6201f378 commit_oid=50cca8f9b37dad2a53d1796cdf6b1c56066b9a3d
2024-07-12T00:29:54.723870Z  INFO update_base_branch:workdir: crates\gitbutler-branch\src\diff.rs:150: close time.busy=46.7ms time.idle=24.0µs project_id=7954371c-c675-4582-b0d3-ec6d6201f378 commit_oid=50cca8f9b37dad2a53d1796cdf6b1c56066b9a3d
2024-07-12T00:29:54.848308Z ERROR update_base_branch: crates\gitbutler-tauri\src\virtual_branches.rs:152: error=Error(failed to checkout index, this should not have happened, we should have already detected this

Caused by:
    failed rmdir - 'C:/Users/<redacted>/Documents/<redacted>/ingest/' is locked: Access is denied.
    ; class=Os (2); code=Locked (-14)) project_id=7954371c-c675-4582-b0d3-ec6d6201f378
2024-07-12T00:29:54.848322Z  INFO update_base_branch: crates\gitbutler-tauri\src\virtual_branches.rs:152: close time.busy=266ms time.idle=27.8µs project_id=7954371c-c675-4582-b0d3-ec6d6201f378
Byron commented 1 month ago

I am not familiar with the internals of gitbutler to understand why it needs to delete handler.py or the whole ingest folder. Do you have any ideas about why this is happening?

Thanks for the update!

As far as I know, GitButler only alters the worktree either when discarding individual files as triggered by the user explicitly, or when running a worktree checkout or reset which is handled by git2. And that's where I am unsure of how it works exactly, and if it's Windows-proven already.

I also think that gitoxide can help here as it's tested on Windows natively, forcing it to not rely on the flexibility of Unix filesystems.