Skip to content

Commit fc802a9

Browse files
committed
git clean untracked files in merge_ds
1 parent f472677 commit fc802a9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

babs/merge.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ def robust_rm_dir(path, max_retries=3, retry_delay=1):
3939
# For datalad datasets, try datalad remove first
4040
if is_datalad_dataset:
4141
try:
42+
# Untracked files in merge_ds can block `datalad remove`, so discard untracked.
43+
if op.exists(op.join(path, '.git')):
44+
subprocess.run(
45+
['git', 'clean', '-fdx'],
46+
cwd=path,
47+
stdout=subprocess.DEVNULL,
48+
stderr=subprocess.DEVNULL,
49+
)
4250
dlapi.remove(path=path, dataset=path, reckless='availability')
4351
# datalad remove might not remove everything, check if path still exists
4452
if not op.exists(path):

0 commit comments

Comments
 (0)