datalad / datalad-ukbiobank

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

failing tests in datalad-extensions runs #82

Closed yarikoptic closed 2 years ago

yarikoptic commented 2 years ago

I with with the release of 0.16.x series. See https://github.com/datalad/datalad-extensions/actions?query=workflow%3Atest-datalad_ukbiobank-maint

yarikoptic commented 2 years ago

ping on this

yarikoptic commented 2 years ago
dirty cut/paste from appveyor ```shell datalad_ukbiobank.tests.test_init.test_base ... ERROR 11 datalad_ukbiobank.tests.test_init.test_bids ... ERROR 12 datalad_ukbiobank.tests.test_update.test_base ... ERROR 13 datalad_ukbiobank.tests.test_update.test_bids ... ERROR 14 datalad_ukbiobank.tests.test_update.test_drop ... ERROR 15 16 ====================================================================== 17 create(ok): /tmp/datalad_temp_test_basef1vxx6b8 (dataset) 18 ERROR: datalad_ukbiobank.tests.test_init.test_base 19 ---------------------------------------------------------------------- 20 Traceback (most recent call last): 21 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/nose/case.py", line 198, in runTest 22 self.test(*self.arg) 23 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/tests/utils.py", line 874, in _wrap_with_tempfile 24 return t(*(arg + (filename,)), **kw) 25 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad_ukbiobank/tests/test_init.py", line 18, in test_base 26 ds.ukb_init('12345', ['20249_2_0', '20249_3_0', '20250_2_0']) 27 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/distribution/dataset.py", line 502, in apply_func 28 return f(*args, **kwargs) 29 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/interface/utils.py", line 447, in eval_func 30 return return_func(*args, **kwargs) 31 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/interface/utils.py", line 439, in return_func 32 results = list(results) 33 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/interface/utils.py", line 369, in generator_func 34 allkwargs): 35 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/interface/utils.py", line 544, in _process_results 36 for res in results: 37 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad_ukbiobank/init.py", line 182, in __call__ 38 'incoming-bids' if bids else 'incoming-native', 39 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/dataset/gitrepo.py", line 437, in call_git 40 read_only=read_only)) 41 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/dataset/gitrepo.py", line 482, in call_git_items_ 42 sep=sep): 43 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/dataset/gitrepo.py", line 345, in _generator_call_git 44 for file_no, content in generator: 45 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/_collections_abc.py", line 317, in __next__ 46 return self.send(None) 47 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/runner/nonasyncrunner.py", line 98, in send 48 self._check_result() 49 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/runner/nonasyncrunner.py", line 80, in _check_result 50 self.runner._check_result() 51 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/runner/nonasyncrunner.py", line 259, in _check_result 52 stderr=decoded_output.get("stderr", None)) 53 datalad.runner.exception.CommandError: CommandError: 'git -c diff.ignoreSubmodules=none merge -m 'Merge incoming' --allow-unrelated-histories incoming-native' failed with exitcode 1 54 -------------------- >> begin captured logging << -------------------- 55 datalad.utils: Level 5: Importing datalad.utils 56 datalad.utils: DEBUG: Maximal length of cmdline string (adjusted for safety margin): 2097152 57 datalad.utils: Level 5: Done importing datalad.utils 58 datalad.runner.gitrunner: Level 9: Will use git under '/usr/lib/git-annex.linux' (no adjustments to PATH if empty string) 59 datalad.runner.runner: DEBUG: Run ['git', '--git-dir=', 'config', '-z', '-l', '--show-origin'] (cwd=None) 60 datalad.runner.protocol: Level 8: Process 5765 started 61 datalad.runner.runnerthreads: Level 5: STDERR: git --git-dir= confi (Thread<(STDERR: git --git-dir= confi, 5)>) started 62 datalad.runner.runnerthreads: Level 5: STDOUT: git --git-dir= confi (Thread<(STDOUT: git --git-dir= confi, 3)>) started 63 datalad.runner.runnerthreads: Level 5: process_waiter (Thread) started 64 datalad.runner.protocol: Level 5: Read 372 bytes from 5765[stdout] 65 datalad.runner.runnerthreads: Level 5: STDOUT: git --git-dir= confi (Thread<(STDOUT: git --git-dir= confi, 3)>) exiting (exit_requested: False, last data: None) 66 datalad.runner.runnerthreads: Level 5: STDERR: git --git-dir= confi (Thread<(STDERR: git --git-dir= confi, 5)>) exiting (exit_requested: False, last data: None) 67 datalad.runner.runnerthreads: Level 5: process_waiter (Thread) exiting 68 datalad.runner.protocol: Level 8: Process 5765 exited with return code 0 69 datalad.runner.runner: DEBUG: Finished ['git', '--git-dir=', 'config', '-z', '-l', '--show-origin'] with status 0 70 datalad.ui: Level 5: Starting importing ui 71 datalad.ui.dialog: Level 5: Starting importing ui.dialog 72 datalad.ui.dialog: Level 5: Done importing ui.dialog 73 datalad.ui: Level 5: Initiating UI switcher 74 datalad.ui: DEBUG: UI set to SilentConsoleLog(out=) 75 datalad.ui: Level 5: Done importing ui 76 --------------------- >> end captured logging << --------------------- 77 78 ====================================================================== 79 ERROR: datalad_ukbiobank.tests.test_init.test_bids 80 ---------------------------------------------------------------------- 81 Traceback (most recent call last): 82 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/nose/case.py", line 198, in runTest 83 self.test(*self.arg) 84 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/tests/utils.py", line 874, in _wrap_with_tempfile 85 return t(*(arg + (filename,)), **kw) 86 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad_ukbiobank/tests/test_init.py", line 49, in test_bids 87 bids=True) 88 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/distribution/dataset.py", line 502, in apply_func 89 return f(*args, **kwargs) 90 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/interface/utils.py", line 447, in eval_func 91 return return_func(*args, **kwargs) 92 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/interface/utils.py", line 439, in return_func 93 results = list(results) 94 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/interface/utils.py", line 369, in generator_func 95 allkwargs): 96 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/interface/utils.py", line 544, in _process_results 97 for res in results: 98 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad_ukbiobank/init.py", line 182, in __call__ 99 'incoming-bids' if bids else 'incoming-native', 100 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/dataset/gitrepo.py", line 437, in call_git 101 read_only=read_only)) 102 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/dataset/gitrepo.py", line 482, in call_git_items_ 103 sep=sep): 104 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/dataset/gitrepo.py", line 345, in _generator_call_git 105 for file_no, content in generator: 106 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/_collections_abc.py", line 317, in __next__ 107 return self.send(None) 108 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/runner/nonasyncrunner.py", line 98, in send 109 self._check_result() 110 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/runner/nonasyncrunner.py", line 80, in _check_result 111 self.runner._check_result() 112 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/runner/nonasyncrunner.py", line 259, in _check_result 113 stderr=decoded_output.get("stderr", None)) 114 datalad.runner.exception.CommandError: CommandError: 'git -c diff.ignoreSubmodules=none merge -m 'Merge incoming' --allow-unrelated-histories incoming-bids' failed with exitcode 1 115 116 ====================================================================== 117 ERROR: datalad_ukbiobank.tests.test_update.test_base 118 ---------------------------------------------------------------------- 119 Traceback (most recent call last): 120 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/nose/case.py", line 198, in runTest 121 self.test(*self.arg) 122 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/tests/utils.py", line 214, in _wrap_skip_if_on_windows 123 return func(*args, **kwargs) 124 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/tests/utils.py", line 874, in _wrap_with_tempfile 125 return t(*(arg + (filename,)), **kw) 126 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/tests/utils.py", line 874, in _wrap_with_tempfile 127 return t(*(arg + (filename,)), **kw) 128 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/tests/utils.py", line 874, in _wrap_with_tempfile 129 return t(*(arg + (filename,)), **kw) 130 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad_ukbiobank/tests/test_update.py", line 68, in test_base 131 ['20227_2_0', '25747_2_0', '25748_2_0', '25748_3_0']) 132 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/distribution/dataset.py", line 502, in apply_func 133 return f(*args, **kwargs) 134 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/interface/utils.py", line 447, in eval_func 135 return return_func(*args, **kwargs) 136 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/interface/utils.py", line 439, in return_func 137 results = list(results) 138 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/interface/utils.py", line 369, in generator_func 139 allkwargs): 140 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/interface/utils.py", line 544, in _process_results 141 for res in results: 142 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad_ukbiobank/init.py", line 182, in __call__ 143 'incoming-bids' if bids else 'incoming-native', 144 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/dataset/gitrepo.py", line 437, in call_git 145 read_only=read_only)) 146 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/dataset/gitrepo.py", line 482, in call_git_items_ 147 sep=sep): 148 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/dataset/gitrepo.py", line 345, in _generator_call_git 149 for file_no, content in generator: 150 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/_collections_abc.py", line 317, in __next__ 151 return self.send(None) 152 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/runner/nonasyncrunner.py", line 98, in send 153 self._check_result() 154 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/runner/nonasyncrunner.py", line 80, in _check_result 155 self.runner._check_result() 156 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/runner/nonasyncrunner.py", line 259, in _check_result 157 stderr=decoded_output.get("stderr", None)) 158 datalad.runner.exception.CommandError: CommandError: 'git -c diff.ignoreSubmodules=none merge -m 'Merge incoming' --allow-unrelated-histories incoming-native' failed with exitcode 1 159 160 ====================================================================== 161 ERROR: datalad_ukbiobank.tests.test_update.test_bids 162 ---------------------------------------------------------------------- 163 Traceback (most recent call last): 164 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/nose/case.py", line 198, in runTest 165 self.test(*self.arg) 166 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/tests/utils.py", line 214, in _wrap_skip_if_on_windows 167 return func(*args, **kwargs) 168 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/tests/utils.py", line 874, in _wrap_with_tempfile 169 return t(*(arg + (filename,)), **kw) 170 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/tests/utils.py", line 874, in _wrap_with_tempfile 171 return t(*(arg + (filename,)), **kw) 172 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad_ukbiobank/tests/test_update.py", line 136, in test_bids 173 bids=True) 174 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/distribution/dataset.py", line 502, in apply_func 175 return f(*args, **kwargs) 176 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/interface/utils.py", line 447, in eval_func 177 return return_func(*args, **kwargs) 178 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/interface/utils.py", line 439, in return_func 179 results = list(results) 180 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/interface/utils.py", line 369, in generator_func 181 allkwargs): 182 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/interface/utils.py", line 544, in _process_results 183 for res in results: 184 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad_ukbiobank/init.py", line 182, in __call__ 185 'incoming-bids' if bids else 'incoming-native', 186 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/dataset/gitrepo.py", line 437, in call_git 187 read_only=read_only)) 188 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/dataset/gitrepo.py", line 482, in call_git_items_ 189 sep=sep): 190 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/dataset/gitrepo.py", line 345, in _generator_call_git 191 for file_no, content in generator: 192 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/_collections_abc.py", line 317, in __next__ 193 return self.send(None) 194 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/runner/nonasyncrunner.py", line 98, in send 195 self._check_result() 196 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/runner/nonasyncrunner.py", line 80, in _check_result 197 self.runner._check_result() 198 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/runner/nonasyncrunner.py", line 259, in _check_result 199 stderr=decoded_output.get("stderr", None)) 200 datalad.runner.exception.CommandError: CommandError: 'git -c diff.ignoreSubmodules=none merge -m 'Merge incoming' --allow-unrelated-histories incoming-bids' failed with exitcode 1 201 202 ====================================================================== 203 ERROR: datalad_ukbiobank.tests.test_update.test_drop 204 ---------------------------------------------------------------------- 205 Traceback (most recent call last): 206 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/nose/case.py", line 198, in runTest 207 self.test(*self.arg) 208 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/tests/utils.py", line 214, in _wrap_skip_if_on_windows 209 return func(*args, **kwargs) 210 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/tests/utils.py", line 874, in _wrap_with_tempfile 211 return t(*(arg + (filename,)), **kw) 212 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/tests/utils.py", line 874, in _wrap_with_tempfile 213 return t(*(arg + (filename,)), **kw) 214 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad_ukbiobank/tests/test_update.py", line 188, in test_drop 215 ['20227_2_0', '25747_2_0', '25748_2_0', '25748_3_0']) 216 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/distribution/dataset.py", line 502, in apply_func 217 return f(*args, **kwargs) 218 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/interface/utils.py", line 447, in eval_func 219 return return_func(*args, **kwargs) 220 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/interface/utils.py", line 439, in return_func 221 results = list(results) 222 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/interface/utils.py", line 369, in generator_func 223 allkwargs): 224 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/interface/utils.py", line 544, in _process_results 225 for res in results: 226 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad_ukbiobank/init.py", line 182, in __call__ 227 'incoming-bids' if bids else 'incoming-native', 228 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/dataset/gitrepo.py", line 437, in call_git 229 read_only=read_only)) 230 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/dataset/gitrepo.py", line 482, in call_git_items_ 231 sep=sep): 232 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/dataset/gitrepo.py", line 345, in _generator_call_git 233 for file_no, content in generator: 234 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/_collections_abc.py", line 317, in __next__ 235 return self.send(None) 236 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/runner/nonasyncrunner.py", line 98, in send 237 self._check_result() 238 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/runner/nonasyncrunner.py", line 80, in _check_result 239 self.runner._check_result() 240 File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/datalad/runner/nonasyncrunner.py", line 259, in _check_result 241 stderr=decoded_output.get("stderr", None)) 242 datalad.runner.exception.CommandError: CommandError: 'git -c diff.ignoreSubmodules=none merge -m 'Merge incoming' --allow-unrelated-histories incoming-native' failed with exitcode 1 243 244 ---------------------------------------------------------------------- 245 Ran 5 tests in 11.974s 246 247 FAILED (errors=5) ```
adswa commented 2 years ago

I can reproduce this - the reason is a failure to merge branches with a merge conflict in .gitattributes:

adina@muninn in /tmp/datalad_temp_test_drop4q54t7kn on git:dl-test-branch
❱ git merge -m "merge incoming" --allow-unrelated-histories incoming-native 
Auto-merging .gitattributes
CONFLICT (add/add): Merge conflict in .gitattributes
Automatic merge failed; fix conflicts and then commit the result.
adina@muninn in /tmp/datalad_temp_test_drop4q54t7kn on dl-test-branch+! (merge)
❱ git st                                                                    1 !
On branch dl-test-branch
You have unmerged paths.
  (fix conflicts and run "git commit")
  (use "git merge --abort" to abort the merge)

Unmerged paths:
  (use "git add <file>..." to mark resolution)
    both added:      .gitattributes

no changes added to commit (use "git add" and/or "git commit -a")
adina@muninn in /tmp/datalad_temp_test_drop4q54t7kn on dl-test-branch+! (merge)
❱ git diff
diff --cc .gitattributes
index af926ef,16e6cfe..0000000
--- a/.gitattributes
+++ b/.gitattributes
@@@ -1,2 -1,2 +1,6 @@@
  * annex.backend=MD5E
 -**/.git* annex.largefiles=nothing
++<<<<<<< HEAD
 +**/.git* annex.largefiles=nothing
++=======
++**/.git* annex.largefiles=nothing
++>>>>>>> incoming-native

The reason for this merge conflict seems to be a EOL in one of the files as indicated by viewing the binary diff between them: Screenshot from 2022-06-07 16-15-07

From a quick glance, it seems the incoming-native branches .gitattribtues is created from cat-file -p'ing the main branch'es config:

        # inherit the standard attributes to ensure uniform behavior
        # across branches
        (repo.pathobj / '.gitattributes').write_text(
            repo.call_git(
                ['cat-file', '-p', '{}:.gitattributes'.format(main_branch)]))

Maybe that (now started to) introduce(s) a newline?

adswa commented 2 years ago

Oh, it might have been introduced with https://github.com/datalad/datalad/commit/fa96e6a6fb497fc09a210d196a5b937a646b984b - since then, the .gitattributes file we write contains a new line. pathlib's write_text method on the other hand only learned to incorporate a newline in Python 3.10 (and we're still testing on and supporting starting from 3.7): https://docs.python.org/3/library/pathlib.html

adswa commented 2 years ago

Here's a patch that fixes it for me and shows that that's indeed the issue:

diff --git a/datalad_ukbiobank/init.py b/datalad_ukbiobank/init.py
index 5732a18..5ef16a0 100644
--- a/datalad_ukbiobank/init.py
+++ b/datalad_ukbiobank/init.py
@@ -125,7 +125,6 @@ class Init(Interface):
             logger=lgr,
             refds=ds.path,
         )
         if 'incoming' in incoming_branches and not force:
             yield dict(
                 res,
@@ -155,7 +154,7 @@ class Init(Interface):
         # across branches
         (repo.pathobj / '.gitattributes').write_text(
             repo.call_git(
-                ['cat-file', '-p', '{}:.gitattributes'.format(main_branch)]))
+                ['cat-file', '-p', '{}:.gitattributes'.format(main_branch)]) + '\n')
         # save to incoming branch, provide path to avoid adding untracked
         # content
         ds.save(
@@ -210,5 +209,5 @@ def _add_incoming_branch(name, incoming_branches, repo, batchfile):
     # inherit the standard attributes to ensure uniform behavior
     # across branches
     (repo.pathobj / '.gitattributes').write_text(
-        repo.call_git(['cat-file', '-p', 'incoming:.gitattributes']))
+        repo.call_git(['cat-file', '-p', 'incoming:.gitattributes']) + '\n')
     repo.save(message='Apply standard Git attributes', paths=['.gitattributes'])

pretty ugly hack. How can we make this prettier? The causing commit was introduced in 0.15.0 if I see it correctly, yet minimal datalad version declared in setup.cfg is 0.14. We could add the patch with a comment to make it pretty once we only support Python 3.10 and up and declare a dependency on datalad 0.15 or higher, or we need to sense if there is a newline and if so, add it?

yarikoptic commented 2 years ago

I would have created a helper ensure_endswith (worth datalad.utils. IMHO) like

def ensure_endswith(s: str, ending: str):
     return s if s.endswith(ending) else s + ending

and use it in both spots. We don't want to breed newlines indefinitely right? ;-)

adswa commented 2 years ago

worth datalad.utils. IMHO

but a helper in core wouldn't make our lives easier, right? :D

yarikoptic commented 2 years ago

not ATM indeed, I just mentioned "hypothetically" worthwhile there. Meanwhile could be local to this repo

adswa commented 2 years ago

I created #85

yarikoptic commented 2 years ago

I think this particular one was addressed in datalad core. new one(s) to come, so freeing up the subject ;)