Skip to content

fix: skip locked directories on checkout to match git behavior STUD-81465 - #34

Open
daniel-dumitrascu wants to merge 2 commits into
developfrom
fix/skip-locked-directories-on-checkout
Open

daniel-dumitrascu wants to merge 2 commits into
developfrom
fix/skip-locked-directories-on-checkout

Conversation

@daniel-dumitrascu

@daniel-dumitrascu daniel-dumitrascu commented Oct 13, 2026 •

Copy link
Copy Markdown

Why

STUD-81465: Studio branch switch, pull and rebase fail with could not rmdir 'Data/': Access is denied when another process holds a working-tree folder open, while command-line git completes the same operation. Telemetry shows 912 unique users hitting this signature in 90 days.

Git tracks files, not directories. After deleting the last tracked file in a directory, both git and libgit2 try to remove the now-empty directory as housekeeping. Git ignores a failure of that step (unpack-trees.c / dir.c discard the rmdir result). libgit2 maps the Windows sharing violation to EBUSY and fails the whole checkout, after some files were already deleted, unless GIT_CHECKOUT_SKIP_LOCKED_DIRECTORIES is set. LibGit2Sharp never exposed that flag.

What

  • GitCheckoutOptsWrapper always adds GIT_CHECKOUT_SKIP_LOCKED_DIRECTORIES to the checkout strategy. Every file change still happens; only the removal of an emptied directory is allowed to fail, and the directory is left behind empty, exactly like git. Covers checkout, rebase, reset, merge, stash and clone, since all build their options here.
  • New test CheckoutSucceedsWhenAnEmptiedDirectoryIsHeldOpenByAnotherProcess holds a handle on the directory without delete sharing (the kind Explorer or a shell keeps on its current directory) and checks out a branch that deletes the only file in it. The test fails without the flag with the ticket's error and passes with it.
  • CHANGES.md entry.

Verification

  • Checkout, Rebase, Reset, Stash, Merge, CherryPick, Revert and Clone fixtures: 213 passed, 2 skipped, 0 failed.
  • Same test with the flag removed fails, confirming it reproduces the defect.
  • A build of this branch dropped into a local Studio verifies the branch switch and pull paths from the ticket.

A new LibGit2Sharp.UiPath package is needed for Studio to pick this up; the Studio-side changes (abort cleanup) are in a separate Studio PR and do not depend on it.

🤖 Generated with Claude Code

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@daniel-dumitrascu

Copy link
Copy Markdown
Author

Companion Studio PR with the rebase abort cleanup: https://github.com/UiPath/Studio/pull/30537

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants