New post: A guide to the adjusted branch (unlocked) #17
No reviewers
Labels
No labels
No milestone
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
www/datalad-blog!17
Loading…
Reference in a new issue
No description provided.
Delete branch "wjm/datalad-blog:adjusted-branch-guide"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I wrote up a comprehensive guide on adjusted branch behavior with the intention to help other Windows users with their DataLad experience, and to help maintainers to better understand how DataLad/git-annex works on Windows. Hopefully this provides some incentive for you to increase the test coverage on Windows, and to finally start welcoming the reset command that is waiting to be reviewed since ... oh it's been so long, I don't even remember ;)
Very nice. I am a bit lost in argumentation in "They are skipped because Windows has no normal branch:" as branch is there, just not checked out... might even not have locked files in it and could be checked out...
Anyways, here is some feedback from my "corporate friend" (claude code) with slight tune ups from me:
on shortcodes
They work well: all four are used, along with all of their parameters, and they do not affect any existing post. Building the site with and without them gave byte-identical output for the older posts. The suggestions below are small, and only the first is worth doing before merging.
Hugo ships a built-in
detailsshortcode (since v0.140.0), and our local file replaces it for the whole site. Why not to just use that instead? if there is a reason for a custom one, rename to e.g.dldetails(see more on that below).Please add a short comment to
md.html. It looks like a no-op, but it is needed:detailsuses the standard{{< >}}notation, so its inner text is not rendered as Markdown, and{{% md %}}uses the Markdown notation to get it rendered. Without the wrappers, raw Markdown shows up in that section. Using{{% details %}}instead makes the whole section disappear, also without a build error, so a comment would save the next person from trying that simplification.singlecould accept an unquoted value.{{< cols single=true >}}builds fine but silently gives two columns, because the template only matches the string"true". This one-word change incols.htmlhandles both forms, and I confirmed the output is unchanged:Optional: move the CSS out of the shortcode
The
<style>block incols.htmlis repeated for each of the 13 uses on the page. PaperMod bundles everything inassets/css/extended/, so moving it toassets/css/extended/cols.csskeeps a single copy and saves about 4.5 KB on this page. The trade-off is that the rules then load on every page of the site, so either way is fine.The names
cols,colandmdare fine as they are (as not conflicting, tested all of this with Hugo 0.169.) But since names are quite short and have a potential to collide potentially in future with built in hugo shortcodes, making them more "unique" would be of better practice. What aboutdlcols, dlcol, dlmd?on content
Since the CI runner is unavailable at the moment, I built the site locally and ran your scripts. The post is in very good shape: I would merge it after a few small corrections below. None of them touch the core explanation. The ones worth the most attention are 1 and 2, which are both about what the simulation can and cannot do.
Build: clean with Hugo 0.169. Shortcodes, tables, footnotes, anchors, both scripts and both SVGs all render, on desktop and phone and in light and dark themes, and the deep link opens the collapsed section. codespell passes.
cover.webpis already onhub, so there is nothing to do there.Small factual corrections
I ran
story-linux.sh, andstory-windows.shunder yourannex.crippledfilesystemsimulation, with git-annex 10.20261026, DataLad 1.8.0, and git 2.43.0 and 2.47.3. As L852 predicts,story-windows.shstops at the failingdatalad update, so I also ran it withoutset -eand ran the puzzle on its own. Line numbers refer toindex.md.updatesteps describe. The switch back only works because the puzzle's fresh dataset has no annexed content yet. With a content-present annexed file saved beforehand, the switch fails after any index refresh onmaster, and the puzzle's owndatalad saveis enough to trigger that. So L864 holds for datasets with content, but not for the puzzle as written.core.symlinks=false, the path text onmasteris a regular file, so git runs the clean filter on it.getMoveRaceRecoveryinCommand/Smudge.hsthen populates the file.core.symlinks=falsealone, withoutannex.crippledfilesystem. So a FAT drive would probably fail the same way, although I have not tested that.adjustpasses if the index is newer than the file, or withcore.symlinks=true(which no longer simulates path text).GIT_TRACE=1 git statusonmasteron Windows would show whether the filter runs there at all.core.symlinks=falseis not always set by git-annex (L234). git-annex only sets it if git has not already done so.checkCrippledFileSysteminAnnex/Init.hssays: "Normally git disables core.symlinks itself". Your Windows output has noDisabling core.symlinksline, while the simulation output does.test_crippled.ymlrunsdatalad.core,datalad.localanddatalad.distributedon a VFAT mount, on real adjusted branches. That is worth a mention next to "we have not tested that" and the "simulated" table cell, and it softens "end up as the ones without tests" a little. Your point still stands forupdate, becausedatalad.distributionis not in that job.get_corresponding_branch()returnsNoneon a normal branch (L787). So on its own it does not "hold on every branch". The idiom already used in DataLad isrepo.get_corresponding_branch() or repo.get_active_branch().test_unlock.pydoes a bit more than skip (L791).test_unlock_directorydoes assert the adjusted-branch behaviour, whiletest_unlockskips its lock-state checks, so namingtest_unlockwould make the sentence accurate.savewith nothing to save does not sync (L349). After a plaingit commit, a no-opdatalad saveleftmasterunchanged, in the simulation and on a real adjusted branch. Asavethat commits something,pushandupdate --how=mergeall carry it over.git statusrestores the content depends on timing (L850). On Linux,git reset --hardwrites the file and the index at the same moment, sogit statusre-reads the file and git-annex restores it, both in the simulation and on a normal adjusted branch. So anyone replaying the Windows order (status, thencat) normally seescontentrather than the pointer. When I forced the index to be newer than the file withtouch .git/index, the pointer survivedgit status,git diffanddatalad status, just as in your Windows column. That may be what happens on Windows, but I could not check.Tiny wording suggestions and optional polish
Wording:
--no-annexdataset stays onmaster.Polish, entirely up to you:
sync-update.svgruns about 3px past the edge.master. Withinit.defaultBranch=main,story-linux.shaborts atfatal: ambiguous argument 'master', so a short note could help readers who run them.What I checked and found correct
story-linux.shruns to the end, including the expected failure, and its output matches the post's Linux columns.basis, the swallowedsave, the failingadjustand the failingupdateall match.saveandpushsync,update --how=merge, the--forcesemantics, theupdate --how=resetsteps and the 1.6.5 version match the sources.uncessaryin the footnote URL is the real page name, so please keep it.Nothing ran on real Windows, so Windows-only results, such as the data loss on
update, were checked against the source and the simulation only.Thanks again for writing this up. It is a real contribution to the project!
Thanks a lot for the thorough review! It made me rethink the post's core, so beyond the fixes it now builds on one idea: reading should cost nothing, writing must keep the stored version intact. A locked file does both through a symlink; on Windows
masterholds path-text files instead (the link target as plain text), which is why the adjusted branch exists."Windows has no normal branch": right,
mastercan be checked out; what Windows lacks are locked files. "Normal branch" is gone, and the test legs are now locked, adjusted and no-symlink.Shortcodes: renamed to
dlcols,dlcol,dlmd,dldetails.dldetailsstays our own because Hugo's built-indetailsdrops theidthe post links to.dlmdhas the comment,single=trueworks unquoted, and the CSS moved toassets/css/extended/.1 and 2: confirmed.
core.symlinks=falsealone reproduces it, so the no-symlink leg sets just that. Why Windows differs:ce_compare_data→index_fdcloses it only afterwards).getMoveRaceRecoverythen renames the content over that open file. Linux allows that, Windows refuses: the same rename inside git's filter call fails withPermissionError: [WinError 5], while outside git it succeeds on Windows too.tryNonAsyncswallows the error, so the file silently stays path text.3–8: corrected; 8 (timing) is now a footnote, the main text gives
git checkout -- .as the reliable way.Commits: shortcodes (2), an SVG fix, the revised post, and the puzzle's answers, now in a collapsed block.
95158c9f7e3f02337fe1rebased, i think it's ready to be merged @yarikoptic
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.