datalad / datalad-ukbiobank

Resources for working with UKBiobank as a DataLad dataset
MIT License
6 stars 12 forks source link

Detection of BIDS-mode does not work with fresh clones #55

Closed mih closed 3 years ago

mih commented 3 years ago

The detection of an incoming-bids branch

https://github.com/datalad/datalad-ukbiobank/blob/46c743ef8fce01c6c321c7943533a9a0c420795f/datalad_ukbiobank/update.py#L248

relies on the assumption of it being locally present. However, in a fresh clone this will not be the case. We should also check remote branches.

mih commented 3 years ago
diff --git a/datalad_ukbiobank/update.py b/datalad_ukbiobank/update.py
index 1da832a..635710f 100644
--- a/datalad_ukbiobank/update.py
+++ b/datalad_ukbiobank/update.py
@@ -245,7 +245,8 @@ class Update(Interface):
             status='ok',
         )

-        want_bids = 'incoming-bids' in repo.get_branches()
+        want_bids = 'incoming-bids' in repo.get_branches() \
+            or any(b.endswith('/incoming-bids') for b in repo.get_remote_branches())
         if want_bids:
             repo.call_git(['checkout', 'incoming-bids'])
             # mark the incoming change as merged