Skip to content

Commit

Permalink
fix: fix chained provision in Windows
Browse files Browse the repository at this point in the history
This commit changes the way in which worktrees
are generated in Windows. In Windows, every provisioned
worktree will have a git config setting that identifies
it as a worktree and holds the source of the worktree.

Further provision calls, i.e. chained provision calls,
in this worktree will use the original source as
provision source.

This is necessary because `git worktree` does not work
together with `git annex` on a crippled file systems, which
means it does not work on most Windows systems.
  • Loading branch information
christian-monch committed Jan 21, 2025
1 parent e81dd7e commit eaf92ec
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion datalad_remake/commands/provision_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,16 @@ def provide(
lgr.debug('Provisioning dataset %s at %s', dataset, resolved_worktree_dir)

if on_windows:
# Check whether we are already in a provisioned worktree. If that is the
# case, we have to provision from the original source.
source = dataset.config.get('datalad.make.provision-source', None)
if not source:
source = dataset.path
# Create a worktree via `git clone` and check out the requested commit
args = ['clone', '.', str(resolved_worktree_dir)]
args = ['clone', source, str(resolved_worktree_dir)]
call_git_lines(args, cwd=dataset.pathobj)
args = ['config', '--add', 'datalad.make.provision-source', source]
call_git_lines(args, cwd=resolved_worktree_dir)
if source_branch:
args = ['checkout', source_branch]
call_git_lines(args, cwd=resolved_worktree_dir)
Expand Down

0 comments on commit eaf92ec

Please sign in to comment.