Skip to content

Commit

Permalink
fix: perform proper provision in an annex remote
Browse files Browse the repository at this point in the history
This commit fixes an issue where subdataset provision
did not work if `provision` was invoked from an annex
special remote-process.

The reason for the error was that the special remote
sets the environment variables `GIT_DIR` and
`GIT_WORK_TREE`, which lead to problems in
`datalad.get`.
  • Loading branch information
christian-monch committed Jan 7, 2025
1 parent a2d2351 commit 124ae4d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion datalad_remake/commands/provision_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,15 @@ def install_subdataset(
absolute_path.as_uri(),
]
call_git_lines(args)
worktree.get(str(subdataset_path), get_data=False, result_renderer='disabled')
stored_environ = dict(os.environ)
try:
for key in ('GIT_DIR', 'GIT_WORK_TREE'):
if key in os.environ:
del os.environ[key]
worktree.get(str(subdataset_path), get_data=False, result_renderer='disabled')
finally:
os.environ.clear()
os.environ.update(stored_environ)
uninstalled_subdatasets.remove(subdataset_path)
uninstalled_subdatasets.update(get_uninstalled_subdatasets(worktree))

Expand Down

0 comments on commit 124ae4d

Please sign in to comment.