Skip to content

worktree mutations - #2977

Draft
Sebastian Thiel (Byron) wants to merge 8 commits into
mainfrom
worktree-create
Draft

worktree mutations#2977
Sebastian Thiel (Byron) wants to merge 8 commits into
mainfrom
worktree-create

Conversation

@Byron

@Byron Sebastian Thiel (Byron) commented Sep 8, 2026

Copy link
Copy Markdown
Member

Tasks

  • refackiew create
  • refackiew delete

@Byron
Sebastian Thiel (Byron) force-pushed the worktree-create branch 5 times, most recently from 7c42198 to 520efea Compare September 11, 2026 03:58
Comment thread gix/tests/gix/repository/worktree.rs Fixed
<!-- agent -->
Paths such as `C:repo` previously replaced the supplied base with the `C:`
prefix and could remain relative. Resolve them against `cwd` when its drive
matches, including verbatim drive prefixes, and otherwise ask Windows for the
current directory on that drive.

Resolve only the drive prefix so subsequent symlinks are followed before
interpreting `..`. Document the base-directory rules and add regressions for
bare drives, matching and different drives, verbatim bases, fully qualified
paths, and symlink-sensitive parent traversal.

Assisted-by: GPT 6.0
Co-authored-by: GPT 6.0 <codex@openai.com>
…e Git conformant

<!-- agent -->
Replace leading dots before stripping repeated `.lock` suffixes, matching Git so
`.lock.lock` becomes `-lock` instead of losing its name. Handle empty sanitized
output without indexing it.

Keep `name_partial_or_sanitize()` returning `BString` and guarantee a nonempty
valid partial reference name. Empty or slash-only input falls back to `-`;
document this Gitoxide-specific behavior so callers need no empty-result
handling.

Assisted-by: GPT 6.0
Co-authored-by: GPT 6.0 <codex@openai.com>
<!-- agent -->
Shared repository modes need more than adding or replacing permission
bits: read-only files must stay read-only, executable files need execute
access wherever sharing grants read access, and directories need search
bits and Git's setgid defaults, including on macOS.

Follow Git's `calc_shared_perm()` and `adjust_shared_perm()`. Add
`set_shared_repository_permissions()` to apply the policy to an existing
path, skipping unchanged permissions and avoiding filesystem access for
a zero policy or on non-Unix platforms.

Require an explicit parsed sharing policy in `dir::create::Iter::new()`
and `dir::create::all()`. Apply it only to newly created directories,
preserving existing directory permissions. Configure retry limits with
`Iter::retries()`, which updates both the original and remaining counts.
Tests cover file modes, directory search and setgid bits, preservation of
existing directories, and retry limits reported in errors.

BREAKING CHANGE: `Iter::new(target, policy)` and
`dir::create::all(dir, retries, policy)` require a parsed sharing policy;
pass `0` to retain the previous umask behavior. Replace
`Iter::new_with_retries(target, retries)` with
`Iter::new(target, policy).retries(retries)`.

Assisted-by: GPT 6.0
Co-authored-by: GPT 6.0 <codex@openai.com>
<!-- agent -->
Temporary files created in shared repositories can require new parent
directories. Callers need those directories to honor the repository's
sharing policy even when the process umask would make them private.

Replace the tuple field of `ContainingDirectory::CreateAllRaceProof` with
named `retries` and `shared_repository_permissions` fields, and pass the
policy to directory creation in `gix_fs`. Setting the policy to `0`
preserves the previous umask behavior. Adapt the existing tempfile tests
to the new variant shape.

Assisted-by: GPT 6.0
Co-authored-by: GPT 6.0 <codex@openai.com>
…ries

<!-- agent -->
Locks in shared repositories need consistent permissions on both the lock
file and any parent directories created during acquisition. Adjusting only
the file can leave those directories inaccessible to other repository users.

Use one explicit parsed Git sharing policy for writable locks, markers,
and newly created directories. Apply it after the process umask in the
common acquisition path and forward it to `gix-tempfile` for directory
creation. A policy of `0` keeps the umask behavior without permission
metadata access. The adjusted file mode reaches the committed resource.

Keep `boundary_directory` as `Option<PathBuf>` and pass the sharing policy
separately. Replace custom-permission and symlink convenience methods with
`File::acquire()` and its optional resource resolver. Tests cover lock,
marker, and committed-resource modes, directory permissions, and rollback.

BREAKING CHANGE: acquisition methods require a `shared_repository_permissions`
argument; pass `0` for the previous umask behavior. `File::acquire()` takes
it before the optional resolver and no longer accepts a permission callback.
The `_with_permissions` and `_following_symlinks` convenience methods are
removed. Use `File::acquire()` with `Some(&acquire::resolve_symlink)` to
follow resource symlinks.

Assisted-by: GPT 6.0
Co-authored-by: GPT 6.0 <codex@openai.com>
<!-- agent -->
Add transactional linked-worktree administration with rollback, then compose
it in gix with existing reference, checkout, index, progress, and interruption
machinery.

Support attached and detached worktrees from bare or non-bare repositories while
rejecting occupied branches and destinations. Keep move, remove, repair, hooks,
sparse checkout, and relative-link configuration out of scope.
Add a Git-compatible removal API that validates linked worktrees, honors dirty and locked states, and deletes checkout and administration data with parallel progress reporting. Keep branch removal with callers and provide compare-and-swap deletion for branches they have already inspected.
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