New post: A guide to the adjusted branch (unlocked) #17

Open
wjm wants to merge 7 commits from wjm/datalad-blog:adjusted-branch-guide into main
11 changed files with 1590 additions and 0 deletions

View file

@ -0,0 +1,7 @@
/* Side-by-side code columns, used by the dlcols/dlcol shortcodes. */
.dlcols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; align-items: start; margin: 1rem 0; }
.dlcols-single { grid-template-columns: minmax(0, 1fr); }
.dlcols > div { min-width: 0; }
.dlcols pre, .dlcols code { font-size: 0.72rem; line-height: 1.4; }
.dlcols pre { overflow-x: auto; white-space: pre; }
@media (max-width: 600px) { .dlcols { grid-template-columns: 1fr; } }

View file

@ -0,0 +1 @@
/annex/objects/MD5E-s71700--6c3bca810b1c9e621130fb7ca69d22f4.webp

After

Width:  |  Height:  |  Size: 66 B

View file

@ -0,0 +1,950 @@
---
title: 'A guide to the adjusted branch (unlocked)'
date: 2026-11-04T12:00:00+01:00
author:
- Jiameng Wu
tags:
- DataLad
- git-annex
- Windows
- adjusted branch
cover:
image: cover.webp
alt: An orange tree branch with whole oranges and, grafted onto its tip, one peeled orange.
relative: true
description: >
How git-annex's adjusted branch works on Windows, where resetting it breaks, and how to test for it, with every example run on Linux and Windows side by side.
showToc: true
hidemeta: false
disableHLJS: true
disableShare: false
hideSummary: false
---
On Windows, every DataLad dataset, unless created with `--no-annex`, lives on an **adjusted branch**. To see why and learn how to work with it, it helps to start with what [git-annex](https://git-annex.branchable.com/) does on Linux and then understand how it is _adjusted_ for Windows.
This guide provides minimal examples that follow each other and compare the two systems side by side: the default branch (`master` in this post) on Linux, and the adjusted branch on Windows. To run them yourself, download the script for [Linux](story-linux.sh) or for [Windows](story-windows.sh) (for Git Bash). Versions used: git-annex 10.20261026 and DataLad 1.8.0 on both machines, with git 2.43.0 on Linux and git 2.56.0 in Git Bash on Windows 11.
## Lock and unlock
Version control for data has to solve one key challenge: keeping every version of large files without making the history large. git is built for source code, small text files whose every version it stores in full; for data, that does not scale. git-annex therefore keeps the content out of git. An **annexed file** lives in three places:
- the **annex store**, `.git/annex/objects/`, holds the content, read-only and named by its **key** (git-annex's name for the object encoding the size in bytes and the **checksum**, a fingerprint of the content), e.g. `MD5E-s8--f75b….bin`. _Each version of the file is an object of its own._
- the **work tree** (what you see on disk) holds a **symlink** (a special file that stores the path to another file and thereby provides _an alternative access path without duplicating the target's content_) to the object in the annex store, e.g. `.git/annex/objects/.../MD5E-s8--f75b….bin`.
- **git** records only the symlink, never the content, in a commit / on a branch [^fn:git-space].
An annexed file stored this way is **locked**: reading is instantaneous and at no cost, since the filesystem simply follows the symlink to the content; writing, however, is prohibited and fails with `Permission denied`, so a stored version of a file is never changed or lost (unless intentionally dropped). To write, you **unlock** the file: git-annex replaces the symlink in the work tree with a writable copy, so one copy stays put while the other is modified. `datalad save` then stores the modification as a new object in the annex store, replaces the file in the work tree with a symlink that points to the new object, commits the new symlink to git, and thereby locks the file again. The old object stays, and checking out an earlier commit brings it back.
On Windows, git-annex does not use symlinks. Instead, it uses a **path-text file**: a regular file holding the same path as plain text. Unlike a symlink, the filesystem cannot follow it: a program that opens it reads the path, not the content. So the content in the annex store is not reachable from the work tree: even reading a file would first require unlocking it, i.e. copying it into the work tree, which takes time and an extra step for every file you want to open. To make reading instantaneous again, git-annex unlocks every annexed file at once, on a dedicated branch, `adjusted/master(unlocked)`[^fn:modes], which `datalad create` checks out by default. The price is space: each annexed file is on disk twice, once in the annex store and once in the work tree.
<!-- brick: 00-locked -->
{{< dlcols >}}
{{% dlcol title="Linux" %}}
```console
$ # create stays on master
$ datalad create repo && cd repo
create(ok): /tmp/…/repo (dataset)
$ echo "content" > file.bin
$ datalad save -m "add file"
add(ok): file.bin (file)
save(ok): . (dataset)
action summary:
add (ok: 1)
save (ok: 1)
$ # a symlink to the read-only content
$ ls -l file.bin
lrwxrwxrwx 116 file.bin -> .git/annex/objects/X2/Zj/MD5E-s8--f75b….bin/MD5E-s8--f75b….bin
$ # git records a symlink (mode 120000)
$ git ls-tree HEAD file.bin
120000 blob af2b030… file.bin
$ # reading follows the symlink to the content
$ cat file.bin
content
$ # unlock: symlink -> writable copy
$ datalad unlock file.bin
[INFO] Unlocking files
[INFO] Recording unlocked state in git
[INFO] Completed unlocking files
unlock(ok): file.bin (file)
$ ls -l file.bin
-rw-r--r-- 8 file.bin
$ # staged as a typechange
$ git status
On branch master
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
typechange: file.bin
$ echo "new content" > file.bin
$ datalad save -m "edit file"
add(ok): file.bin (file)
save(ok): . (dataset)
action summary:
add (ok: 1)
save (ok: 1)
$ # save: new read-only object, new symlink
$ ls -l file.bin
lrwxrwxrwx 118 file.bin -> .git/annex/objects/w2/Vg/MD5E-s12--f8a6….bin/MD5E-s12--f8a6….bin
```
{{% /dlcol %}}
{{% dlcol title="Windows" %}}
```console
$ # create checks out the adjusted branch
$ datalad create repo && cd repo
[INFO] Detected a filesystem without fifo support.
[INFO] Disabling ssh connection caching.
[INFO] Detected a crippled filesystem.
[INFO] Entering an adjusted branch where files are unlocked as this filesystem does not support locked files.
[INFO] Switched to branch 'adjusted/master(unlocked)'
[INFO]
create(ok): C:\…\repo (dataset)
$ echo "content" > file.bin
$ datalad save -m "add file"
add(ok): file.bin (file)
save(ok): . (dataset)
action summary:
add (ok: 1)
save (ok: 1)
$ # a regular, writable file with the content
$ ls -l file.bin
-rw-r--r-- 8 file.bin
$ # git records a regular file (mode 100644)
$ git ls-tree HEAD file.bin
100644 blob a21bb0d… file.bin
$ # reading the copy gives the content
$ cat file.bin
content
$ # unlock has nothing to do, no "unlock(ok)"
$ datalad unlock file.bin
[INFO] Unlocking files
[INFO] Completed unlocking files
$ ls -l file.bin
-rw-r--r-- 8 file.bin
$ # nothing changed
$ git status
On branch adjusted/master(unlocked)
nothing to commit, working tree clean
$ echo "new content" > file.bin
$ datalad save -m "edit file"
add(ok): file.bin (file)
save(ok): . (dataset)
action summary:
add (ok: 1)
save (ok: 1)
$ # a regular file with the new content
$ ls -l file.bin
-rw-r--r-- 12 file.bin
```
{{% /dlcol %}}
{{< /dlcols >}}
<!-- /brick -->
## master & adjusted/master(unlocked)
Is the adjusted branch a different kind of history? Not really. A **commit** is a snapshot of all files plus a reference to its parent commit; following the parents back gives the history. A **branch** is just a bookmark: a name that points to one commit and moves forward whenever you commit on it. **HEAD** marks what you have checked out: it points to a branch, and through it to that branch's newest commit, whose snapshot your work tree shows. **`master`** (or `main`) is the default branch git checks out when a new repository is created.
The **adjusted branch**, `adjusted/master(unlocked)`, is a branch like any other. It points to one commit, "git-annex adjusted branch", whose parent is the tip of `master`, its **corresponding branch**. This **adjusting commit** changes only how git records the annexed files: from a symlink (mode `120000`, with the path to the object as content) to a regular file (mode `100644`, with a **pointer** as content, a short text naming the object by its key). The work tree holds yet something else: an **unlocked** file, the content itself as a writable copy (unless the content is dropped).
<!-- brick: 01-refs -->
{{< dlcols >}}
{{% dlcol title="Linux" %}}
```console
$ # HEAD is your last commit
$ git log --oneline --decorate --summary -2
6e02b1a (HEAD -> master) edit file
d7f438d add file
create mode 120000 file.bin
$ # only master
$ git branch
git-annex
* master
```
{{% /dlcol %}}
{{% dlcol title="Windows" %}}
```console
$ # HEAD is the adjusting commit:
$ # it turns the symlink into a file;
$ # your last commit is below it
$ git log --oneline --decorate --summary -3
6c1191a (HEAD -> adjusted/master(unlocked)) git-annex adjusted branch
mode change 120000 => 100644 file.bin
95790da (master) edit file
500fb52 add file
create mode 120000 file.bin
$ # on the adjusted branch, master next to it
$ git branch
* adjusted/master(unlocked)
git-annex
master
```
{{% /dlcol %}}
{{< /dlcols >}}
<!-- /brick -->
`master` can still be checked out on Windows, but its annexed files are path-text files:
<!-- brick: 02-two-shapes -->
{{< dlcols >}}
{{% dlcol title="Linux" %}}
```console
$ # already on master, the symlink is followed
$ cat file.bin
new content
```
{{% /dlcol %}}
{{% dlcol title="Windows" %}}
```console
$ # check out master
$ git checkout master
Switched to branch 'master'
$ # a path-text file
$ cat file.bin
.git/annex/objects/w2/Vg/MD5E-s12--f8a6….bin/MD5E-s12--f8a6….bin
$ # 118 bytes (the path), not 12 (content)
$ ls -l file.bin
-rw-r--r-- 118 file.bin
$ # git records 120000 (symlink)!
$ git ls-tree HEAD file.bin
120000 blob 4488793… file.bin
$ # back on the adjusted branch: content
$ git checkout "adjusted/master(unlocked)"
Switched to branch 'adjusted/master(unlocked)'
$ cat file.bin
new content
```
{{% /dlcol %}}
{{< /dlcols >}}
<!-- /brick -->
On Windows `core.symlinks` is `false`, so git creates no symlinks, yet it keeps recording mode `120000`: the history stays the same as on Linux. To tell whether such a file was modified, git compares its text with the recorded path.
| on Windows | `master` | `adjusted/master(unlocked)` |
|---|---|---|
| git records | mode `120000` (symlink) and the object's path: `.git/annex/objects/…/<key>/<key>` | mode `100644` (regular file) and a pointer: `/annex/objects/<key>` |
| work tree gets | a path-text file | an unlocked file |
{{< dldetails summary="Under the hood: how does git-annex place the content in the work tree?" id="the-clean-and-smudge-filter" >}}
{{% dlmd %}}
It takes two git mechanisms: a filter that git runs on every file passing between the work tree and the repository, and hooks that git runs after a checkout or merge.
{{% /dlmd %}}
<!-- brick: 03-filter -->
{{< dlcols >}}
{{% dlcol title="Linux" %}}
```console
$ # the filter is set up here too ...
$ git check-attr filter -- file.bin
file.bin: filter: annex
$ cat .git/info/attributes
* filter=annex
$ git config --get-regexp '^filter\.annex'
filter.annex.smudge git-annex smudge -- %f
filter.annex.clean git-annex smudge --clean -- %f
filter.annex.process git-annex filter-process
$ ls .git/hooks | grep -v sample
post-checkout
post-merge
post-receive
pre-commit
pre-push
$ # ... but git stores a symlink:
$ # the filter has nothing to do
$ git cat-file -p :file.bin
.git/annex/objects/w2/Vg/MD5E-s12--f8a6….bin/MD5E-s12--f8a6….bin
$ cat file.bin
new content
```
{{% /dlcol %}}
{{% dlcol title="Windows" %}}
```console
$ # every path goes through the annex filter
$ git check-attr filter -- file.bin
file.bin: filter: annex
$ cat .git/info/attributes
* filter=annex
$ git config --get-regexp '^filter\.annex'
filter.annex.smudge git-annex smudge -- %f
filter.annex.clean git-annex smudge --clean -- %f
filter.annex.process git-annex filter-process
$ # hooks run "git annex smudge --update"
$ ls .git/hooks | grep -v sample
post-checkout
post-merge
post-receive
pre-commit
pre-push
$ # git stores a pointer,
$ # git-annex put the content on disk
$ git cat-file -p :file.bin
/annex/objects/MD5E-s12--f8a6….bin
$ cat file.bin
new content
```
{{% /dlcol %}}
{{< /dlcols >}}
<!-- /brick -->
{{% dlmd %}}
- **clean** runs on `git add`: it moves the content into the annex and hands git the pointer.
- **smudge** runs on checkout. git-annex's smudge filter does not write the content: it writes the pointer and notes the file, and the hook below fills in the content right after the checkout, if the content is present. (Large files would otherwise pass through git's memory.)
Three pieces make this work, and `git annex init` writes all three:
1. the **driver** in `.git/config` (`filter.annex.*`): *how* to run the filter;
2. the **assignment** in `.git/info/attributes` (`* filter=annex`): *which paths* use it;
3. the **hooks** in `.git/hooks/`: `post-checkout` and `post-merge` run `git annex smudge --update`, which replaces the pointers the filter wrote with the content.
A driver without an assignment is never called.
To check a repository, ask git (`git check-attr filter -- <path>` prints `annex` or `unspecified`) rather than reading `.git/config`.
The same pieces exist on Linux, but on `master` files are locked and git records symlinks, so the filter has nothing to do.
{{% /dlmd %}}
{{< /dldetails >}}
## How your work reaches `master`
So on Windows, you work on the adjusted branch: on `master`, your annexed files are path-text files, not your data. But only what reaches `master` counts, because `master` is what gets published; anything else can be lost. So how does your work get there?
To carry your work over, git-annex keeps a third **ref** (a named reference to a commit, like a branch or HEAD): `refs/basis/adjusted/master(unlocked)`, `basis` for short. It records which `master` commit the adjusted branch was built from, separately from `master`, because `master` can change under its feet, for example when someone pushes into your repository. Every `datalad save` ends with a local sync (`git annex sync --no-push --no-pull`), in four steps:
1. DataLad stores the content as a new object in the annex store and commits a pointer to that object on the adjusted branch.
2. git-annex replays this commit on top of `basis`, recording the file as a symlink, as on Linux.
3. `basis` moves to the replayed commit, and `master` is set to the same commit.
4. git-annex makes a new adjusting commit on top. It takes your tree as it is, so the unlocked file in your work tree stays untouched.
git-annex only replays commits that come after an adjusting commit; that becomes important when you reset.
![The local sync during datalad save: replay on top of basis, master follows, new adjusting commit on top](sync.svg)
So after a sync, `HEAD` is a fresh adjusting commit, not your last commit, and `HEAD~1` is the tip of `master`.
A plain `git commit` works too, but it lands on the adjusted branch, on top of the adjusting commit, and reaches `master` only at the next sync: an `update`, a `push`, or a `save` that commits something. So stick to `datalad save`.
<!-- brick: 04-save -->
{{< dlcols >}}
{{% dlcol title="Linux" %}}
```console
$ # only master: your commits
$ git log --oneline --decorate --decorate-refs=refs/heads/ --decorate-refs=refs/basis/
6e02b1a (master) edit file
d7f438d add file
99622d4 [DATALAD] new dataset
```
{{% /dlcol %}}
{{% dlcol title="Windows" %}}
```console
$ # master and basis on your last commit,
$ # the adjusted branch one commit above
$ git log --oneline --decorate --decorate-refs=refs/heads/ --decorate-refs=refs/basis/
6c1191a (adjusted/master(unlocked)) git-annex adjusted branch
95790da (master, refs/basis/adjusted/master(unlocked)) edit file
500fb52 add file
07b40fc [DATALAD] new dataset
0cf32cf commit before entering adjusted branch
```
{{% /dlcol %}}
{{< /dlcols >}}
<!-- /brick -->
`push` runs the same local sync as `save`, then publishes only `master` and `git-annex`: the adjusted branch and `basis` never leave your machine, and a collaborator on Linux sees an ordinary dataset.
`update` does more. On Linux, `datalad update --how=merge` is a plain `git merge` of `origin/master`. On Windows, it runs `git annex sync --pull`, in three steps:
1. As in a `save`, commits on the adjusted branch that have not reached `master` yet are replayed on top of `basis`, and `master` follows, unless it has moved on its own.
2. If your local `master` has moved on its own, its commits are merged on top of `basis`, and `master` is set to the result, something a `save` never does.
3. The sibling's commit is merged on top of `basis`, not into the adjusted branch, where the unlocked files would cause needless merge conflicts. `basis` and `master` move to the merge result, and this time git-annex does not reuse your tree: the incoming files are not in it yet, and in `basis` they are recorded as symlinks. So it builds the new adjusting commit afresh from `basis`, recording every one of them as a pointer instead.
![What datalad update does on an adjusted branch: your commit replayed onto basis, master's own commit and the sibling's commit merged on top of basis, a new adjusting commit built from basis](sync-update.svg)
## Resetting on the adjusted branch
To me, being able to go back and rewrite history is the whole point of version control.
If you only ever move forward, a digital lab notebook serves you as well as git or DataLad.
Because every decision can be undone, you can try things and take wrong turns without fear.
In a team, reset is also how you adopt history your collaborators rewrote: a merge would keep the discarded commits, and your next `push` would bring them right back.
On `master` on Linux, going back is a single `git reset`. On the adjusted branch, it is where things truly break and what led me to write this guide.
### What happens with a plain `git reset --hard` on the adjusted branch?
Say you save some data, then accidentally overwrite it with junk, and you want the junk commit gone:
<!-- brick: 05-reset-view -->
{{< dlcols >}}
{{% dlcol title="Linux" %}}
```console
$ echo "data" > data.bin
$ datalad save -m "add data"
add(ok): data.bin (file)
save(ok): . (dataset)
action summary:
add (ok: 1)
save (ok: 1)
$ # unlock to modify
$ datalad unlock data.bin
[INFO] Unlocking files
[INFO] Recording unlocked state in git
[INFO] Completed unlocking files
unlock(ok): data.bin (file)
$ echo "junk" > data.bin
$ datalad save -m "overwrite with junk"
add(ok): data.bin (file)
save(ok): . (dataset)
action summary:
add (ok: 1)
save (ok: 1)
$ # drop the junk commit
$ git reset --hard HEAD~1
HEAD is now at 43d524e add data
$ # data again
$ cat data.bin
data
$ # the junk commit is gone
$ git log --oneline --decorate --decorate-refs=refs/heads/ --decorate-refs=refs/basis/ -4 HEAD master
43d524e (master) add data
6e02b1a edit file
d7f438d add file
99622d4 [DATALAD] new dataset
```
{{% /dlcol %}}
{{% dlcol title="Windows" %}}
```console
$ echo "data" > data.bin
$ datalad save -m "add data"
add(ok): data.bin (file)
save(ok): . (dataset)
action summary:
add (ok: 1)
save (ok: 1)
$ # always unlocked
$ echo "junk" > data.bin
$ datalad save -m "overwrite with junk"
add(ok): data.bin (file)
save(ok): . (dataset)
action summary:
add (ok: 1)
save (ok: 1)
$ # drop the last commit with HEAD~1?
$ git reset --hard HEAD~1
HEAD is now at d56eacd overwrite with junk
$ # nope! HEAD~1 is master's junk commit:
$ # only the adjusting commit is gone
$ # drop one more?
$ git reset --hard HEAD~1
HEAD is now at cf4c030 add data
$ # still not data: master's path text
$ cat data.bin
.git/annex/objects/f3/2G/MD5E-s5--6137….bin/MD5E-s5--6137….bin
$ # master and basis still on the junk commit,
$ # the adjusted branch below them
$ git log --oneline --decorate --decorate-refs=refs/heads/ --decorate-refs=refs/basis/ -4 HEAD master
d56eacd (master, refs/basis/adjusted/master(unlocked)) overwrite with junk
cf4c030 (adjusted/master(unlocked)) add data
95790da edit file
500fb52 add file
```
{{% /dlcol %}}
{{< /dlcols >}}
<!-- /brick -->
The first reset removed git-annex's adjusting commit, and with it the unlocked files in your work tree.
Every commit below it is a `master` commit, which records annexed files as symlinks, so no matter how far back you reset, an annexed file only ever becomes a path-text file (the content itself is still safe in the annex store).
Meanwhile neither `basis` nor `master` has moved: both still point at the commit you meant to discard. And you are still on `adjusted/master(unlocked)`.
So you give up on getting the content back to the work tree and keep working:
<!-- brick: 09-reset-below-basis -->
{{< dlcols >}}
{{% dlcol title="Linux" %}}
```console
$ # data is back, keep working
$ echo "precious" > precious.bin
$ datalad save -m "add precious data"
add(ok): precious.bin (file)
save(ok): . (dataset)
action summary:
add (ok: 1)
save (ok: 1)
$ # "add precious data" on top of "add data"
$ git log --oneline --decorate --decorate-refs=refs/heads/ --decorate-refs=refs/basis/ -4 HEAD master
b868b97 (master) add precious data
43d524e add data
6e02b1a edit file
d7f438d add file
$ git log --all --oneline --no-decorate --grep "add precious data"
b868b97 add precious data
$ ls
data.bin
file.bin
precious.bin
```
{{% /dlcol %}}
{{% dlcol title="Windows" %}}
```console
$ # keep working
$ echo "precious" > precious.bin
$ datalad save -m "add precious data"
add(ok): precious.bin (file)
save(ok): . (dataset)
action summary:
add (ok: 1)
save (ok: 1)
$ # a new adjusting commit on the junk;
$ # "add precious data" is not in master
$ git log --oneline --decorate --decorate-refs=refs/heads/ --decorate-refs=refs/basis/ -4 HEAD master
0059e08 (adjusted/master(unlocked)) git-annex adjusted branch
d56eacd (master, refs/basis/adjusted/master(unlocked)) overwrite with junk
cf4c030 add data
95790da edit file
$ # ... nor on any branch
$ git log --all --oneline --no-decorate --grep "add precious data"
$ # precious.bin is in the adjusting commit,
$ # and so is data.bin's way back to data
$ git log -1 --stat --oneline --no-decorate
0059e08 git-annex adjusted branch
data.bin | 2 +-
precious.bin | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
$ # precious.bin is still on disk, for now
$ ls
data.bin
file.bin
precious.bin
```
{{% /dlcol %}}
{{< /dlcols >}}
<!-- /brick -->
`datalad save` reports `ok`, but your new commit is nowhere.
As said above, git-annex only replays commits made on top of an adjusting commit, and the first reset removed it, so your new commit is skipped. git-annex still puts a new adjusting commit on top of `basis`, which still holds the commit you meant to discard, but not the one you meant to keep. That new adjusting commit takes the tree of your last commit as it is, so by mistake it includes your new file, as well as the change that undid the discarded commit. Your file is still on disk, for now, but its commit is already gone from every branch.
Meanwhile a collaborator pushes a commit to the sibling, and you `update` as usual:
<!-- brick: 13-update-loss -->
{{< dlcols >}}
{{% dlcol title="Linux" %}}
```console
$ datalad update --how=merge -s sibling
[INFO] Fetching updates for Dataset(/tmp/…/repo)
[INFO] Start enumerating objects
[INFO] Start counting objects
[INFO] Start compressing objects
merge(ok): . (dataset) [Merged sibling/master]
update.annex_merge(ok): . (dataset) [Merged annex branch]
update(ok): . (dataset)
action summary:
merge (ok: 1)
update (ok: 1)
update.annex_merge (ok: 1)
$ git log --oneline --decorate --decorate-refs=refs/heads/ --decorate-refs=refs/basis/ -4 HEAD master
d7f2b7f (master) add theirs
b868b97 add precious data
43d524e add data
6e02b1a edit file
$ # precious.bin is still there
$ ls
data.bin
file.bin
precious.bin
theirs.bin
$ # data, as after the reset
$ cat data.bin
data
```
{{% /dlcol %}}
{{% dlcol title="Windows" %}}
```console
$ datalad update --how=merge -s sibling
[INFO] Fetching updates for Dataset("C:\…\repo")
[INFO] Start enumerating objects
[INFO] Start counting objects
[INFO] Start compressing objects
update.annex_sync(ok): . (dataset) [Ran git-annex-sync]
update(ok): . (dataset)
action summary:
update (ok: 1)
update.annex_sync (ok: 1)
$ # their commit on top of the junk,
$ # a new adjusting commit on top;
$ # no precious data anywhere
$ git log --oneline --decorate --decorate-refs=refs/heads/ --decorate-refs=refs/basis/ -4 HEAD master
8c3026a (adjusted/master(unlocked)) git-annex adjusted branch
1e1845c (master, refs/basis/adjusted/master(unlocked)) add theirs
d56eacd overwrite with junk
cf4c030 add data
$ # precious.bin is gone: the adjusted
$ # branch was rebuilt from basis
$ ls
data.bin
file.bin
theirs.bin
$ # the junk is back: master never dropped it
$ cat data.bin
junk
```
{{% /dlcol %}}
{{< /dlcols >}}
<!-- /brick -->
Your new file is gone, and the discarded commit is back. That's because `update` builds the adjusted branch afresh from `basis`, which has never seen your new file or the reset. And that's why the adjusted branch is considered _disposable_.
The rule: **never move the adjusted branch backwards.**
Even discarding an *unsaved* edit has a catch:
<!-- brick: 06-reset-pointer -->
{{< dlcols >}}
{{% dlcol title="Linux" %}}
```console
$ echo "content" > notes.bin
$ datalad save -m "add notes"
add(ok): notes.bin (file)
save(ok): . (dataset)
action summary:
add (ok: 1)
save (ok: 1)
$ datalad unlock notes.bin
[INFO] Unlocking files
[INFO] Recording unlocked state in git
[INFO] Completed unlocking files
unlock(ok): notes.bin (file)
$ echo "edited" > notes.bin
$ git reset --hard
HEAD is now at fbded2e add notes
$ git status
On branch master
nothing to commit, working tree clean
$ # the content: git restored the symlink
$ cat notes.bin
content
$ git checkout -- .
$ cat notes.bin
content
```
{{% /dlcol %}}
{{% dlcol title="Windows" %}}
```console
$ echo "content" > notes.bin
$ datalad save -m "add notes"
add(ok): notes.bin (file)
save(ok): . (dataset)
action summary:
add (ok: 1)
save (ok: 1)
$ echo "edited" > notes.bin
$ git reset --hard
HEAD is now at 9363553 git-annex adjusted branch
$ # git calls the work tree clean ...
$ git status
On branch adjusted/master(unlocked)
nothing to commit, working tree clean
$ # ... but the file holds the pointer:
$ # no hook ran after the reset
$ cat notes.bin
/annex/objects/MD5E-s8--f75b….bin
$ # the post-checkout hook fills it in
$ git checkout -- .
$ # the content is back
$ cat notes.bin
content
```
{{% /dlcol %}}
{{< /dlcols >}}
<!-- /brick -->
The content is still in the annex, but the work tree holds the pointer.
`git reset` writes back what git recorded, the pointer, but unlike a checkout it runs no hook, so git-annex never gets the chance to place the content (see [how git-annex places the content in the work tree](#the-clean-and-smudge-filter) above).
Beware: `git status`, `git diff` and `datalad status` all call such a file clean, because the pointer matches what is committed; only looking at the content shows the problem.
The reliable way to bring the content back is `git checkout -- .`: it fires the `post-checkout` hook, which runs `git annex smudge --update` and places the content.[^fn:timing]
### How to reset the adjusted branch correctly
If you have followed the tale of the adjusted branch so far, you probably already have an idea how to do a proper reset on Windows. Here is the recipe[^fn:synced-reset]:
1. check out the corresponding branch: `git checkout master`
2. reset as usual: `git reset --hard <target>`
3. rebuild the adjusted branch: `git annex adjust --unlock --force`
<!-- brick: 10-reset-corresponding -->
{{< dlcols single="true" >}}
{{% dlcol title="Windows" %}}
```console
$ # leave the adjusted branch
$ git checkout master
Switched to branch 'master'
$ # reset the real history to before the junk
$ git reset --hard ':/add data'
HEAD is now at cf4c030 add data
$ # rebuild the adjusted branch from the reset master
$ git annex adjust --unlock --force
adjust
Switched to branch 'adjusted/master(unlocked)'
ok
$ git branch
* adjusted/master(unlocked)
git-annex
master
$ # master and basis are reset, the adjusted branch on top of them
$ git log --oneline --decorate --decorate-refs=refs/heads/ --decorate-refs=refs/basis/ -3
1444cdf (adjusted/master(unlocked)) git-annex adjusted branch
cf4c030 (master, refs/basis/adjusted/master(unlocked)) add data
95790da edit file
$ # precious.bin does not come back: it never reached master
$ ls
data.bin
file.bin
$ # but junk is gone!
$ cat data.bin
data
```
{{% /dlcol %}}
{{< /dlcols >}}
<!-- /brick -->
DataLad does these steps in `datalad update --how=reset`, to reset to the sibling's state; it works on adjusted branches since DataLad 1.6.5.
## Dos and don'ts
| | do | don't |
|---|---|---|
| edit files | on `adjusted/master(unlocked)` | on `master` (path-text files, not data) |
| commit | `datalad save` | `git commit` (reaches `master` only at the next sync) |
| discard unsaved edits | `git reset --hard`, then `git checkout -- .` | stop after `git reset --hard` (pointers, not content) |
| discard commits | reset `master`, then `git annex adjust --unlock --force`; or `datalad update --how=reset` | `git reset --hard HEAD~N` on `adjusted/master(unlocked)` |
## Bonus: Why tests are skipped on Windows, and how to test the adjusted branch
Many tests in DataLad's test suite are skipped on Windows, because they rely on properties that hold on Linux but not on Windows:
1. `HEAD` is the tip of `master`, so `HEAD~1` is your previous commit (see [master & adjusted/master(unlocked)](#master--adjustedmasterunlocked));
2. a commit is in `master` right away, without a sync (see [How your work reaches `master`](#how-your-work-reaches-master));
3. a reset moves the history (see [Resetting on the adjusted branch](#resetting-on-the-adjusted-branch));
4. annexed files are locked: read-only, behind a symlink (see [Lock and unlock](#lock-and-unlock)).
Such a test fails on Windows for reasons unrelated to what it tests, and the easy fix is to skip it. So the code paths that only run on the adjusted branch end up with the fewest tests.
**Strategy 1: write tests that do not rely on these properties.** Most of them can be avoided in the test itself, and then the same test holds on every branch:
- Compare against the corresponding branch, not `HEAD`: on the adjusted branch `HEAD` is the adjusting commit, and its hash changes with every sync. Ask for the corresponding branch instead (`git rev-parse master`, or in DataLad `repo.get_corresponding_branch() or repo.get_active_branch()`).
- Name commits, do not count them from `HEAD`: `HEAD~1` is your previous commit on `master` and only the tip of `master` on the adjusted branch, as the first reset example shows. Use the commit's hash, or count from `master`.
- Build history with `datalad save`, not `git commit`: a plain commit on the adjusted branch reaches `master` only at the next sync, so a test that commits with git and then inspects `master` sees nothing.
- Check the outcome, not the report: tests assert on three levels, a result record saying `ok`, matching commit hashes, and the content being there, and each level alone can miss a problem. After `git reset --hard`, a file holding only the pointer passes the first two: the status is clean and the hashes match, and only reading the file shows that its content is missing. Can a test also pass the first and the third level, but not the second? Check out [the puzzle below](#a-puzzle-for-the-curious-mind).
- Where behavior really differs, assert the difference: ask `repo.is_managed_branch()` and assert what each kind of branch should do. DataLad's `test_unlock` gets halfway: on `master` it expects a saved file to be read-only and `datalad unlock` to report `ok`, but on the adjusted branch it only skips these checks instead of asserting what happens there.
- Make siblings bare: create a test's sibling with `git init --bare`, not `datalad create`. On Windows a created dataset has an adjusted branch of its own, and a `push` only moves its `master`: its work tree and its own next `save` never see the pushed commits, so the test ends up exercising the sibling's adjusted branch instead of what it meant to.
**Strategy 2: run every test on three legs.** Instead of skipping, run each test on three legs, so that every part of it actually runs, on Linux too. The **locked** leg works directly on `master` and is the baseline that checks parity with git. The **adjusted** leg (`git annex adjust --unlock`, with symlinks on `master`) exercises the branch logic behind properties 1 to 3. The **no-symlink** leg is an adjusted branch with `core.symlinks=false`, as on Windows, and adds the consequences behind property 4: path-text files instead of locked files on `master`. On Windows only the locked leg is impossible, so only that leg is skipped.
**Strategy 3: reproduce Windows on Linux, and know where that stops.** The no-symlink leg brings Windows' behavior to a Linux machine: set `core.symlinks=false` and enter the adjusted branch:
<!-- brick: 14-simulate -->
{{< dlcols single="true" >}}
{{% dlcol title="Linux" %}}
```console
$ # an adjusted branch with path text on master, as on Windows
$ cd .. && datalad create sim && cd sim
create(ok): /tmp/…/sim (dataset)
$ git config core.symlinks false
$ git annex adjust --unlock
adjust
Switched to branch 'adjusted/master(unlocked)'
ok
$ # write without unlocking
$ echo "kept" > kept.bin
$ datalad save -m "add kept"
add(ok): kept.bin (file)
save(ok): . (dataset)
action summary:
add (ok: 1)
save (ok: 1)
$ echo "discarded" > discarded.bin
$ datalad save -m "add discarded"
add(ok): discarded.bin (file)
save(ok): . (dataset)
action summary:
add (ok: 1)
save (ok: 1)
$ # the correct reset from above, discarding the last commit ...
$ git checkout master
Switched to branch 'master'
$ git reset --hard HEAD~1
git-annex: git status will show kept.bin to be modified, since content availability has changed and git-annex was unable to update the index. This is only a cosmetic problem affecting git status; git add, git commit, etc won't be affected. To fix the git status display, you can run: git-annex restage
HEAD is now at fb05db2 add kept
$ # ... fails on Linux, while it works on Windows
$ git annex adjust --unlock --force
adjust
error: Your local changes to the following files would be overwritten by checkout:
kept.bin
Please commit your changes or stash them before you switch branches.
Aborting
failed
adjust: 1 failed
```
{{% /dlcol %}}
{{< /dlcols >}}
<!-- /brick -->
With this setup, most of this post reproduces on Linux: the adjusting commit, `basis`, path-text files on `master`, the pointer after a reset and the swallowed `save`. One thing does not: the correct reset in the example above fails here, with the "git-annex restage" warning as the first sign. Here is what happens:
1. git checks whether a path-text file on `master` was modified, for example in `git status`, `git reset --hard` or a checkout, and to do so passes it through git-annex's filter.
2. git-annex finds the key in the path text and, if the content is present, puts it into the file.
3. The file now holds the content, but git recorded the symlink's path, so git calls the file modified.
On Windows, step 2 fails: git keeps the file open during step 2, Windows does not replace an open file, and git-annex ignores the error. The file stays a path-text file, and nothing is modified.
In this Linux setup, the same replacement also breaks two more steps of this post that work on Windows: checking out the adjusted branch again from `master`, and `datalad update` after the resets, so the data loss on `update` cannot be replayed on Linux either. Leave these to Windows CI. A FAT-formatted drive on Linux should behave the same, since Linux replaces open files on any filesystem; I have not tested that.
| | Linux | Windows |
|---|---|---|
| locked | yes | no: skip this leg |
| adjusted | yes, with `git annex adjust --unlock` | yes |
| no-symlink | yes, with `core.symlinks=false`; path text replaced by present content: expected failure | yes |
In short: skip a test only where its case cannot even be set up, which is only the locked leg on Windows. Where a case passes on Windows but fails on the no-symlink leg on Linux, mark it as an expected failure (`pytest.mark.xfail(strict=False)`) there only, for example when `core.symlinks` is `false` on a system that is not Windows. The test then still runs and documents the gap, an unexpected pass is no error, and on Windows CI it is an ordinary test that has to pass.
### A puzzle for the curious mind
Say you checked out `master` by accident, saved a file there, checked out the adjusted branch again, saved another file, and pushed. Here is what you did on Windows:
<!-- brick: 15-puzzle -->
{{< dlcols single="true" >}}
{{% dlcol title="Windows" %}}
```console
$ cd .. && datalad create puzzle && cd puzzle
$ git init -q --bare ../puzzle-sibling.git
$ datalad siblings add -s sibling --url ../puzzle-sibling.git
$ datalad push --to sibling
$ datalad clone ../puzzle-sibling.git ../collaborator
$ # by accident on master
$ git checkout master
$ echo "first" > saved-on-master.bin
$ datalad save -m "save on master"
$ # back to the adjusted branch
$ git checkout "adjusted/master(unlocked)"
$ echo "second" > saved-on-adjusted.bin
$ datalad save -m "save on the adjusted branch"
$ datalad push --to sibling
```
{{% /dlcol %}}
{{< /dlcols >}}
<!-- /brick -->
1. Which of the two files, `saved-on-master.bin` and `saved-on-adjusted.bin`, are in your work tree (with the adjusted branch checked out), on the adjusted branch, on `master`, and on the sibling? And for which of them does the sibling have the content?
Then your collaborator adds a file and pushes it, and you `update`:
<!-- brick: 16-puzzle-update -->
{{< dlcols single="true" >}}
{{% dlcol title="Windows" %}}
```console
$ # your collaborator adds a file and pushes it
$ datalad -C ../collaborator update --how=merge
$ echo "third" > ../collaborator/saved-on-sibling.bin
$ datalad -C ../collaborator save -m "save on sibling"
$ datalad -C ../collaborator push --to origin
$ # you update
$ datalad update --how=merge -s sibling
```
{{% /dlcol %}}
{{< /dlcols >}}
<!-- /brick -->
2. Which files are where now?
3. And after a second `datalad push`?
{{< dldetails summary="Answers" >}}
{{% dlmd %}}
1. Work tree and adjusted branch: only `saved-on-adjusted.bin`. `master`: only `saved-on-master.bin`. The sibling records only `saved-on-master.bin`, but has the content only of `saved-on-adjusted.bin`.
2. Work tree, adjusted branch and `master`: all three files. The sibling records `saved-on-master.bin` and `saved-on-sibling.bin`, and has the content of `saved-on-adjusted.bin` and `saved-on-sibling.bin`.
3. All three files are everywhere, and the sibling has the content of all three.
{{% /dlmd %}}
{{< /dldetails >}}
And the open question this guide leaves you with: how could the tests for `save`, `update` and `push` be improved to catch this? Consider contributing a pull request to [DataLad](https://github.com/datalad/datalad), and don't forget to tag me [@just-meng](https://github.com/just-meng) ;)
[^fn:git-space]: If this sounds a little abstract or confusing to you, don't worry! A branch is just a name that points to a particular commit. When you check out / switch to a branch, git fills your work tree with files recorded by the commit the branch points to.
[^fn:modes]: `git annex adjust` has other modes too (`--lock`, `--fix`, `--hide-missing`, `--unlock-present`), which this guide does not cover.
[^fn:synced-reset]: With a git-annex from before its June 2026 fix ([avoid unnecessary synced branches](https://git-annex.branchable.com/todo/avoid_uncessary_synced_branches/)), also delete a leftover `synced/master` before rebuilding the adjusted branch, with `git branch -D synced/master`. Otherwise the next sync merges the discarded commits back in ([datalad#7772](https://github.com/datalad/datalad/issues/7772)).
[^fn:timing]: Sometimes a `git status` puts the content back too. git re-reads a file through git-annex's filter when the file is not older than the index, and git-annex then replaces the pointer with the content. On Linux, a reset usually writes the file and the index within the same moment, so the next `git status` restores the content. On Windows this fails for the same reason as described in the [bonus section](#bonus-why-tests-are-skipped-on-windows-and-how-to-test-the-adjusted-branch): git still has the file open.

View file

@ -0,0 +1,125 @@
#!/bin/bash
# The Linux side of "A guide to the adjusted branch (unlocked)".
# Every command shown in the post's Linux columns, in order.
# Lines marked "# setup" are not shown in the post but needed to run through.
# It works in a fresh temporary directory and leaves it behind for you to inspect.
set -eu
cd "$(mktemp -d)"
export GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=init.defaultBranch GIT_CONFIG_VALUE_0=master # setup: start new repositories on master, as in the post
# --- 00-locked
# create stays on master
datalad create repo && cd repo
echo "content" > file.bin
datalad save -m "add file"
# a symlink to the read-only content
ls -l file.bin
# git records a symlink (mode 120000)
git ls-tree HEAD file.bin
# reading follows the symlink to the content
cat file.bin
# unlock: symlink -> writable copy
datalad unlock file.bin
ls -l file.bin
# staged as a typechange
git status
echo "new content" > file.bin
datalad save -m "edit file"
# save: new read-only object, new symlink
ls -l file.bin
# --- 01-refs
# HEAD is your last commit
git log --oneline --decorate --summary -2
# only master
git branch
# --- 02-two-shapes
# already on master, the symlink is followed
cat file.bin
# --- 03-filter
# the filter is set up here too ...
git check-attr filter -- file.bin
cat .git/info/attributes
git config --get-regexp '^filter\.annex'
ls .git/hooks | grep -v sample
# ... but git stores a symlink:
# the filter has nothing to do
git cat-file -p :file.bin
cat file.bin
# --- 04-save
# only master: your commits
git log --oneline --decorate --decorate-refs=refs/heads/ --decorate-refs=refs/basis/
# --- 05-reset-view
echo "data" > data.bin
datalad save -m "add data"
# unlock to modify
datalad unlock data.bin
echo "junk" > data.bin
datalad save -m "overwrite with junk"
# drop the junk commit
git reset --hard HEAD~1
# data again
cat data.bin
# the junk commit is gone
git log --oneline --decorate --decorate-refs=refs/heads/ --decorate-refs=refs/basis/ -4 HEAD master
# --- 09-reset-below-basis
# data is back, keep working
echo "precious" > precious.bin
datalad save -m "add precious data"
# "add precious data" on top of "add data"
git log --oneline --decorate --decorate-refs=refs/heads/ --decorate-refs=refs/basis/ -4 HEAD master
git log --all --oneline --no-decorate --grep "add precious data"
ls
# --- 13-update-loss
git clone -q --bare . ../sibling.git # setup
git remote add sibling ../sibling.git # setup
datalad clone ../sibling.git ../theirs # setup
echo "theirs" > ../theirs/theirs.bin # setup
datalad -C ../theirs save -m "add theirs" # setup
datalad -C ../theirs push --to origin # setup
datalad update --how=merge -s sibling
git log --oneline --decorate --decorate-refs=refs/heads/ --decorate-refs=refs/basis/ -4 HEAD master
# precious.bin is still there
ls
# data, as after the reset
cat data.bin
# --- 06-reset-pointer
echo "content" > notes.bin
datalad save -m "add notes"
datalad unlock notes.bin
echo "edited" > notes.bin
git reset --hard
git status
# the content: git restored the symlink
cat notes.bin
git checkout -- .
cat notes.bin
# --- 14-simulate
# an adjusted branch with path text on master, as on Windows
cd .. && datalad create sim && cd sim
git config core.symlinks false
git annex adjust --unlock
# write without unlocking
echo "kept" > kept.bin
datalad save -m "add kept"
echo "discarded" > discarded.bin
datalad save -m "add discarded"
# the correct reset from above, discarding the last commit ...
git checkout master
git reset --hard HEAD~1
set +e # setup
# ... fails on Linux, while it works on Windows
git annex adjust --unlock --force
set -e # setup

View file

@ -0,0 +1,175 @@
#!/bin/bash
# The Windows side of "A guide to the adjusted branch (unlocked)".
# Every command shown in the post's Windows columns, in order, in Git Bash.
# Lines marked "# setup" are not shown in the post but needed to run through.
# It works in a fresh temporary directory and leaves it behind for you to inspect.
set -eu
cd "$(mktemp -d)"
export GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=init.defaultBranch GIT_CONFIG_VALUE_0=master # setup: start new repositories on master, as in the post
# --- 00-locked
# create checks out the adjusted branch
datalad create repo && cd repo
echo "content" > file.bin
datalad save -m "add file"
# a regular, writable file with the content
ls -l file.bin
# git records a regular file (mode 100644)
git ls-tree HEAD file.bin
# reading the copy gives the content
cat file.bin
# unlock has nothing to do, no "unlock(ok)"
datalad unlock file.bin
ls -l file.bin
# nothing changed
git status
echo "new content" > file.bin
datalad save -m "edit file"
# a regular file with the new content
ls -l file.bin
# --- 01-refs
# HEAD is the adjusting commit:
# it turns the symlink into a file;
# your last commit is below it
git log --oneline --decorate --summary -3
# on the adjusted branch, master next to it
git branch
# --- 02-two-shapes
# check out master
git checkout master
# a path-text file
cat file.bin
# 118 bytes (the path), not 12 (content)
ls -l file.bin
# git records 120000 (symlink)!
git ls-tree HEAD file.bin
# back on the adjusted branch: content
git checkout "adjusted/master(unlocked)"
cat file.bin
# --- 03-filter
# every path goes through the annex filter
git check-attr filter -- file.bin
cat .git/info/attributes
git config --get-regexp '^filter\.annex'
# hooks run "git annex smudge --update"
ls .git/hooks | grep -v sample
# git stores a pointer,
# git-annex put the content on disk
git cat-file -p :file.bin
cat file.bin
# --- 04-save
# master and basis on your last commit,
# the adjusted branch one commit above
git log --oneline --decorate --decorate-refs=refs/heads/ --decorate-refs=refs/basis/
# --- 05-reset-view
echo "data" > data.bin
datalad save -m "add data"
# always unlocked
echo "junk" > data.bin
datalad save -m "overwrite with junk"
# drop the last commit with HEAD~1?
git reset --hard HEAD~1
# nope! HEAD~1 is master's junk commit:
# only the adjusting commit is gone
# drop one more?
git reset --hard HEAD~1
# still not data: master's path text
cat data.bin
# master and basis still on the junk commit,
# the adjusted branch below them
git log --oneline --decorate --decorate-refs=refs/heads/ --decorate-refs=refs/basis/ -4 HEAD master
# --- 09-reset-below-basis
# keep working
echo "precious" > precious.bin
datalad save -m "add precious data"
# a new adjusting commit on the junk;
# "add precious data" is not in master
git log --oneline --decorate --decorate-refs=refs/heads/ --decorate-refs=refs/basis/ -4 HEAD master
# ... nor on any branch
git log --all --oneline --no-decorate --grep "add precious data"
# precious.bin is in the adjusting commit,
# and so is data.bin's way back to data
git log -1 --stat --oneline --no-decorate
# precious.bin is still on disk, for now
ls
# --- 13-update-loss
git clone -q --bare . ../sibling.git # setup
git remote add sibling ../sibling.git # setup
datalad clone ../sibling.git ../theirs # setup
echo "theirs" > ../theirs/theirs.bin # setup
datalad -C ../theirs save -m "add theirs" # setup
datalad -C ../theirs push --to origin # setup
datalad update --how=merge -s sibling
# their commit on top of the junk,
# a new adjusting commit on top;
# no precious data anywhere
git log --oneline --decorate --decorate-refs=refs/heads/ --decorate-refs=refs/basis/ -4 HEAD master
# precious.bin is gone: the adjusted
# branch was rebuilt from basis
ls
# the junk is back: master never dropped it
cat data.bin
# --- 06-reset-pointer
echo "content" > notes.bin
datalad save -m "add notes"
echo "edited" > notes.bin
git reset --hard
# git calls the work tree clean ...
git status
# ... but the file holds the pointer:
# no hook ran after the reset
cat notes.bin
# the post-checkout hook fills it in
git checkout -- .
# the content is back
cat notes.bin
# --- 10-reset-corresponding
# leave the adjusted branch
git checkout master
# reset the real history to before the junk
git reset --hard ':/add data'
# rebuild the adjusted branch from the reset master
git annex adjust --unlock --force
git branch
# master and basis are reset, the adjusted branch on top of them
git log --oneline --decorate --decorate-refs=refs/heads/ --decorate-refs=refs/basis/ -3
# precious.bin does not come back: it never reached master
ls
# but junk is gone!
cat data.bin
# --- 15-puzzle
cd .. && datalad create puzzle && cd puzzle
git init -q --bare ../puzzle-sibling.git
datalad siblings add -s sibling --url ../puzzle-sibling.git
datalad push --to sibling
datalad clone ../puzzle-sibling.git ../collaborator
# by accident on master
git checkout master
echo "first" > saved-on-master.bin
datalad save -m "save on master"
# back to the adjusted branch
git checkout "adjusted/master(unlocked)"
echo "second" > saved-on-adjusted.bin
datalad save -m "save on the adjusted branch"
datalad push --to sibling
# --- 16-puzzle-update
# your collaborator adds a file and pushes it
datalad -C ../collaborator update --how=merge
echo "third" > ../collaborator/saved-on-sibling.bin
datalad -C ../collaborator save -m "save on sibling"
datalad -C ../collaborator push --to origin
# you update
datalad update --how=merge -s sibling

View file

@ -0,0 +1,186 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 720 420" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, 'DejaVu Sans Mono', monospace" font-size="12">
<title>What datalad update does on an adjusted branch, in three steps</title>
<style>
.card { fill: #f6f8fa; stroke: #d0d7de; }
.head { font-weight: bold; font-size: 13px; fill: #24292f; text-anchor: middle; }
.legend { font-size: 10.5px; fill: #8250df; text-anchor: middle; }
.col { stroke: #d0d7de; stroke-dasharray: 4 4; }
.box { stroke-width: 1.5; rx: 6; }
.yours { fill: #ddf4ff; stroke: #54aeff; }
.theirs { fill: #dafbe1; stroke: #4ac26b; }
.adjust { fill: #fff8c5; stroke: #d4a72c; }
.plain { fill: #ffffff; stroke: #8c959f; }
.optional { fill: #fbefff; stroke: #a475f9; stroke-dasharray: 5 4; }
.label { fill: #24292f; text-anchor: middle; dominant-baseline: middle; }
.small { font-size: 10.5px; fill: #57606a; }
.arrow { stroke: #cf222e; stroke-width: 2; fill: none; marker-end: url(#tip); }
.cross { stroke: #cf222e; stroke-width: 5; stroke-linecap: round; }
.caption { fill: #24292f; font-size: 13px; text-anchor: middle; }
.anim { animation-duration: 30s; animation-iteration-count: infinite; animation-timing-function: ease-in-out; }
/* timeline (30 s): 0-3 before | 3-7 step 1 (your commit onto basis; master stays) |
7-12 step 2 (master's own commit merged onto basis; master set to the result) |
12-17 step 3 (sibling's commit merged onto basis; master follows) |
17-24 rebuild (drop old adjusting commit, build afresh from basis) | 24-30 after */
@keyframes ghost1 { 0%, 10% { opacity: 0; transform: translate(0, 0) } 11% { opacity: 1; transform: translate(0, 0) }
19.5% { opacity: 1; transform: translate(240px, 45px) } 21%, 100% { opacity: 0; transform: translate(240px, 45px) } }
@keyframes bYours { 0%, 19.5% { opacity: 0 } 21.5%, 97% { opacity: 1 } 100% { opacity: 0 } }
@keyframes ar1 { 0%, 10.5% { opacity: 0 } 12%, 20% { opacity: 1 } 21.5%, 100% { opacity: 0 } }
@keyframes mOwn { 0%, 33% { opacity: 1 } 36%, 97% { opacity: 0 } 100% { opacity: 1 } }
@keyframes ghost2 { 0%, 24% { opacity: 0; transform: translate(0, 0) } 25% { opacity: 1; transform: translate(0, 0) }
32% { opacity: 1; transform: translate(-240px, -45px) } 33.5%, 100% { opacity: 0; transform: translate(-240px, -45px) } }
@keyframes bSaved { 0%, 32% { opacity: 0 } 34%, 97% { opacity: 1 } 100% { opacity: 0 } }
@keyframes ar2 { 0%, 24% { opacity: 0 } 25.5%, 32.5% { opacity: 1 } 34%, 100% { opacity: 0 } }
@keyframes mSet { 0%, 35% { opacity: 0 } 39%, 97% { opacity: 1 } 100% { opacity: 0 } }
@keyframes ar3 { 0%, 34% { opacity: 0 } 35.5%, 39% { opacity: 1 } 40.5%, 100% { opacity: 0 } }
@keyframes srcfade { 0%, 49% { opacity: 1 } 52%, 97% { opacity: 0.35 } 100% { opacity: 1 } }
@keyframes ghost3 { 0%, 40.5% { opacity: 0; transform: translate(0, 0) } 41.5% { opacity: 1; transform: translate(0, 0) }
49% { opacity: 1; transform: translate(0, 95px) } 50.5%, 100% { opacity: 0; transform: translate(0, 95px) } }
@keyframes bTheirs { 0%, 49% { opacity: 0 } 51%, 97% { opacity: 1 } 100% { opacity: 0 } }
@keyframes ar4 { 0%, 40.5% { opacity: 0 } 42%, 49.5% { opacity: 1 } 51%, 100% { opacity: 0 } }
@keyframes mTheirs { 0%, 52% { opacity: 0 } 56%, 97% { opacity: 1 } 100% { opacity: 0 } }
@keyframes ar5 { 0%, 51% { opacity: 0 } 52.5%, 56% { opacity: 1 } 57.5%, 100% { opacity: 0 } }
@keyframes crossin { 0%, 57% { opacity: 0 } 60%, 62% { opacity: 1 } 66%, 100% { opacity: 0 } }
@keyframes oldout { 0%, 62% { opacity: 1 } 66%, 97% { opacity: 0 } 100% { opacity: 1 } }
@keyframes aYours { 0%, 66% { opacity: 0 } 68.5%, 97% { opacity: 1 } 100% { opacity: 0 } }
@keyframes aSaved { 0%, 68% { opacity: 0 } 70.5%, 97% { opacity: 1 } 100% { opacity: 0 } }
@keyframes aTheirs { 0%, 70% { opacity: 0 } 72.5%, 97% { opacity: 1 } 100% { opacity: 0 } }
@keyframes newadj { 0%, 72.5% { opacity: 0 } 76%, 97% { opacity: 1 } 100% { opacity: 0 } }
@keyframes ar6 { 0%, 72% { opacity: 0 } 73.5%, 80% { opacity: 1 } 81.5%, 100% { opacity: 0 } }
@keyframes cap0 { 0%, 9% { opacity: 1 } 10.5%, 100% { opacity: 0 } }
@keyframes cap1 { 0%, 9.5% { opacity: 0 } 11%, 22.5% { opacity: 1 } 24%, 100% { opacity: 0 } }
@keyframes cap2 { 0%, 23% { opacity: 0 } 24.5%, 39.5% { opacity: 1 } 41%, 100% { opacity: 0 } }
@keyframes cap3 { 0%, 40% { opacity: 0 } 41.5%, 56.5% { opacity: 1 } 58%, 100% { opacity: 0 } }
@keyframes cap4 { 0%, 57% { opacity: 0 } 58.5%, 80% { opacity: 1 } 81.5%, 100% { opacity: 0 } }
@keyframes cap5 { 0%, 81% { opacity: 0 } 82.5%, 97% { opacity: 1 } 99%, 100% { opacity: 0 } }
.ghost1 { animation-name: ghost1; } .bYours { animation-name: bYours; } .ar1 { animation-name: ar1; }
.mOwn { animation-name: mOwn; } .ghost2 { animation-name: ghost2; } .bSaved { animation-name: bSaved; }
.ar2 { animation-name: ar2; } .mSet { animation-name: mSet; } .ar3 { animation-name: ar3; }
.srcfade { animation-name: srcfade; } .ghost3 { animation-name: ghost3; } .bTheirs { animation-name: bTheirs; }
.ar4 { animation-name: ar4; } .mTheirs { animation-name: mTheirs; } .ar5 { animation-name: ar5; }
.crossin { animation-name: crossin; } .oldout { animation-name: oldout; }
.aYours { animation-name: aYours; } .aSaved { animation-name: aSaved; } .aTheirs { animation-name: aTheirs; }
.newadj { animation-name: newadj; } .ar6 { animation-name: ar6; }
.cap0 { animation-name: cap0; } .cap1 { animation-name: cap1; } .cap2 { animation-name: cap2; }
.cap3 { animation-name: cap3; } .cap4 { animation-name: cap4; } .cap5 { animation-name: cap5; }
@media (prefers-reduced-motion: reduce) {
.anim { animation: none; }
.ghost1, .ghost2, .ghost3, .ar1, .ar2, .ar3, .ar4, .ar5, .ar6, .mOwn, .crossin, .oldout,
.cap0, .cap1, .cap2, .cap3, .cap4 { opacity: 0; }
.srcfade { opacity: 0.35; }
}
</style>
<defs>
<marker id="tip" viewBox="0 0 12 12" refX="10" refY="6" markerWidth="12" markerHeight="12"
markerUnits="userSpaceOnUse" orient="auto">
<path d="M2,2 L10,6 L2,10" fill="none" stroke="#cf222e" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</marker>
</defs>
<rect class="card" x="0.5" y="0.5" width="719" height="419" rx="10"/>
<!-- columns -->
<text class="head" x="120" y="30">adjusted/master(unlocked)</text>
<text class="head" x="360" y="30">basis</text>
<text class="head" x="600" y="30">master</text>
<text class="legend" x="592" y="46">dashed: only if master moved on its own</text>
<line class="col" x1="240" y1="18" x2="240" y2="330"/>
<line class="col" x1="480" y1="18" x2="480" y2="330"/>
<!-- the sibling's new commit -->
<g class="anim srcfade">
<rect class="box theirs" x="260" y="56" width="200" height="36"/>
<text class="label" x="360" y="69">add theirs</text>
<text class="label small" x="360" y="83">fetched from the sibling</text>
</g>
<!-- shared history -->
<rect class="box plain" x="20" y="290" width="200" height="36"/><text class="label" x="120" y="308">edit file</text>
<rect class="box plain" x="260" y="290" width="200" height="36"/><text class="label" x="360" y="308">edit file</text>
<rect class="box plain" x="500" y="290" width="200" height="36"/><text class="label" x="600" y="308">edit file</text>
<!-- before, adjusted branch: old adjusting commit and your not-yet-synced commit -->
<g class="anim oldout">
<rect class="box adjust" x="20" y="245" width="200" height="36"/><text class="label" x="120" y="263">git-annex adjusted branch</text>
<rect class="box yours" x="20" y="200" width="200" height="36"/><text class="label" x="120" y="213">add yours</text>
<text class="label small" x="120" y="227">not synced yet</text>
</g>
<g class="anim crossin">
<line class="cross" x1="38" y1="248" x2="202" y2="278"/>
<line class="cross" x1="38" y1="278" x2="202" y2="248"/>
</g>
<!-- before, master: a commit of its own -->
<g class="anim mOwn">
<rect class="box optional" x="500" y="245" width="200" height="36"/><text class="label" x="600" y="258">saved on master</text>
<text class="label small" x="600" y="272">master moved on its own</text>
</g>
<!-- step 1: your commit replayed on top of basis; master does not follow -->
<g class="anim ghost1">
<rect class="box yours" x="20" y="200" width="200" height="36"/><text class="label" x="120" y="218">add yours</text>
</g>
<path class="anim ar1 arrow" d="M222,218 C246,218 236,263 256,263"/>
<g class="anim bYours">
<rect class="box yours" x="260" y="245" width="200" height="36"/><text class="label" x="360" y="263">add yours</text>
</g>
<!-- step 2: master's own commit merged on top of basis; master set to the result -->
<g class="anim ghost2">
<rect class="box optional" x="500" y="245" width="200" height="36"/><text class="label" x="600" y="263">saved on master</text>
</g>
<path class="anim ar2 arrow" d="M498,263 C470,263 486,218 464,218"/>
<g class="anim bSaved">
<rect class="box optional" x="260" y="200" width="200" height="36"/><text class="label" x="360" y="213">saved on master</text>
<text class="label small" x="360" y="227">merged</text>
</g>
<g class="anim mSet">
<rect class="box yours" x="500" y="245" width="200" height="36"/><text class="label" x="600" y="263">add yours</text>
<rect class="box optional" x="500" y="200" width="200" height="36"/><text class="label" x="600" y="218">saved on master</text>
</g>
<path class="anim ar3 arrow" d="M462,240 L496,240"/>
<!-- step 3: the sibling's commit merged on top of basis; master follows -->
<g class="anim ghost3">
<rect class="box theirs" x="260" y="60" width="200" height="36"/><text class="label" x="360" y="78">add theirs</text>
</g>
<path class="anim ar4 arrow" d="M360,94 L360,151"/>
<g class="anim bTheirs">
<rect class="box theirs" x="260" y="155" width="200" height="36"/><text class="label" x="360" y="168">add theirs</text>
<text class="label small" x="360" y="182">merged</text>
</g>
<g class="anim mTheirs">
<rect class="box theirs" x="500" y="155" width="200" height="36"/><text class="label" x="600" y="173">add theirs</text>
</g>
<path class="anim ar5 arrow" d="M462,173 L496,173"/>
<!-- the adjusted branch, built afresh from basis -->
<g class="anim aYours">
<rect class="box yours" x="20" y="245" width="200" height="36"/><text class="label" x="120" y="263">add yours</text>
</g>
<g class="anim aSaved">
<rect class="box optional" x="20" y="200" width="200" height="36"/><text class="label" x="120" y="218">saved on master</text>
</g>
<g class="anim aTheirs">
<rect class="box theirs" x="20" y="155" width="200" height="36"/><text class="label" x="120" y="173">add theirs</text>
</g>
<g class="anim newadj">
<rect class="box adjust" x="20" y="110" width="200" height="36"/><text class="label" x="120" y="123">git-annex adjusted branch</text>
<text class="label small" x="120" y="137">new: built from basis</text>
</g>
<path class="anim ar6 arrow" d="M258,165 C232,165 246,128 222,128"/>
<!-- captions -->
<text class="anim cap0 caption" x="360" y="368">Before: your commit is not synced yet, master has one of</text>
<text class="anim cap0 caption" x="360" y="388">its own, and the sibling has a new one.</text>
<text class="anim cap1 caption" x="360" y="368">1. Your commit is replayed on top of basis. master has</text>
<text class="anim cap1 caption" x="360" y="388">moved on its own, so it does not follow.</text>
<text class="anim cap2 caption" x="360" y="368">2. master's own commit is merged on top of basis,</text>
<text class="anim cap2 caption" x="360" y="388">and master is set to the result.</text>
<text class="anim cap3 caption" x="360" y="368">3. The sibling's commit is merged on top of basis,</text>
<text class="anim cap3 caption" x="360" y="388">and master follows.</text>
<text class="anim cap4 caption" x="360" y="368">The old adjusting commit is dropped;</text>
<text class="anim cap4 caption" x="360" y="388">a new one is built afresh from basis.</text>
<text class="anim cap5 caption" x="360" y="368">After: all three agree, with every commit in them.</text>
</svg>

After

Width:  |  Height:  |  Size: 12 KiB

View file

@ -0,0 +1,126 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 720 380" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, 'DejaVu Sans Mono', monospace" font-size="12">
<title>The local sync during datalad save on an adjusted branch</title>
<style>
.card { fill: #f6f8fa; stroke: #d0d7de; }
.head { font-weight: bold; font-size: 13px; fill: #24292f; text-anchor: middle; }
.col { stroke: #d0d7de; stroke-dasharray: 4 4; }
.box { stroke-width: 1.5; rx: 6; }
.yours { fill: #ddf4ff; stroke: #54aeff; }
.adjust { fill: #fff8c5; stroke: #d4a72c; }
.plain { fill: #ffffff; stroke: #8c959f; }
.label { fill: #24292f; text-anchor: middle; dominant-baseline: middle; }
.small { font-size: 10.5px; fill: #57606a; }
.arrow { stroke: #cf222e; stroke-width: 2; fill: none; marker-end: url(#tip); }
.cross { stroke: #cf222e; stroke-width: 5; stroke-linecap: round; }
.caption { fill: #24292f; font-size: 13.5px; text-anchor: middle; }
.anim { animation-duration: 21s; animation-iteration-count: infinite; animation-timing-function: ease-in-out; }
/* timeline (21 s): 0-3 before | 3-6.75 replay | 6.75-10.5 master follows |
10.5-16.5 re-anchor (cross, move down, new adjusting commit) | 16.5-21 after */
@keyframes ghostmove { 0%, 14% { opacity: 0; transform: translate(0, 0) } 15% { opacity: 1; transform: translate(0, 0) }
28.5% { opacity: 1; transform: translate(240px, 50px) } 30.5%, 100% { opacity: 0; transform: translate(240px, 50px) } }
@keyframes in1 { 0%, 28.5% { opacity: 0 } 31%, 97% { opacity: 1 } 100% { opacity: 0 } }
@keyframes in2 { 0%, 36% { opacity: 0 } 42%, 97% { opacity: 1 } 100% { opacity: 0 } }
@keyframes crossin { 0%, 50% { opacity: 0 } 54%, 57% { opacity: 1 } 62%, 100% { opacity: 0 } }
@keyframes oldout { 0%, 57% { opacity: 1 } 62%, 97% { opacity: 0 } 100% { opacity: 1 } }
@keyframes movedown { 0%, 57% { transform: translate(0, 0) } 64%, 97% { transform: translate(0, 50px) } 100% { transform: translate(0, 0) } }
@keyframes subold { 0%, 57% { opacity: 1 } 61%, 97% { opacity: 0 } 100% { opacity: 1 } }
@keyframes subnew { 0%, 59% { opacity: 0 } 64%, 97% { opacity: 1 } 100% { opacity: 0 } }
@keyframes newadj { 0%, 64% { opacity: 0 } 70%, 97% { opacity: 1 } 100% { opacity: 0 } }
@keyframes ar1 { 0%, 14% { opacity: 0 } 16%, 30% { opacity: 1 } 32%, 100% { opacity: 0 } }
@keyframes ar2 { 0%, 32% { opacity: 0 } 34%, 48% { opacity: 1 } 50%, 100% { opacity: 0 } }
@keyframes ar3 { 0%, 63% { opacity: 0 } 65%, 75% { opacity: 1 } 77%, 100% { opacity: 0 } }
@keyframes cap0 { 0%, 13% { opacity: 1 } 15%, 100% { opacity: 0 } }
@keyframes cap1 { 0%, 14% { opacity: 0 } 16%, 31% { opacity: 1 } 33%, 100% { opacity: 0 } }
@keyframes cap2 { 0%, 32% { opacity: 0 } 34%, 49% { opacity: 1 } 51%, 100% { opacity: 0 } }
@keyframes cap3 { 0%, 50% { opacity: 0 } 52%, 77% { opacity: 1 } 79%, 100% { opacity: 0 } }
@keyframes cap4 { 0%, 78% { opacity: 0 } 80%, 97% { opacity: 1 } 99%, 100% { opacity: 0 } }
.ghostmove { animation-name: ghostmove; }
.in1 { animation-name: in1; } .in2 { animation-name: in2; }
.crossin { animation-name: crossin; } .oldout { animation-name: oldout; }
.movedown { animation-name: movedown; }
.subold { animation-name: subold; } .subnew { animation-name: subnew; }
.newadj { animation-name: newadj; }
.ar1 { animation-name: ar1; } .ar2 { animation-name: ar2; } .ar3 { animation-name: ar3; }
.cap0 { animation-name: cap0; } .cap1 { animation-name: cap1; } .cap2 { animation-name: cap2; }
.cap3 { animation-name: cap3; } .cap4 { animation-name: cap4; }
@media (prefers-reduced-motion: reduce) {
.anim { animation: none; }
.ghostmove, .crossin, .oldout, .subold, .ar1, .ar2, .ar3, .cap0, .cap1, .cap2, .cap3 { opacity: 0; }
.movedown { transform: translate(0, 50px); }
}
</style>
<defs>
<marker id="tip" viewBox="0 0 12 12" refX="10" refY="6" markerWidth="12" markerHeight="12"
markerUnits="userSpaceOnUse" orient="auto">
<path d="M2,2 L10,6 L2,10" fill="none" stroke="#cf222e" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</marker>
</defs>
<rect class="card" x="0.5" y="0.5" width="719" height="379" rx="10"/>
<!-- columns -->
<text class="head" x="120" y="32">adjusted/master(unlocked)</text>
<text class="head" x="360" y="32">basis</text>
<text class="head" x="600" y="32">master</text>
<line class="col" x1="240" y1="20" x2="240" y2="320"/>
<line class="col" x1="480" y1="20" x2="480" y2="320"/>
<!-- shared history: add file, edit file -->
<g>
<rect class="box plain" x="20" y="270" width="200" height="36"/><text class="label" x="120" y="288">add file</text>
<rect class="box plain" x="260" y="270" width="200" height="36"/><text class="label" x="360" y="288">add file</text>
<rect class="box plain" x="500" y="270" width="200" height="36"/><text class="label" x="600" y="288">add file</text>
<rect class="box plain" x="20" y="220" width="200" height="36"/><text class="label" x="120" y="238">edit file</text>
<rect class="box plain" x="260" y="220" width="200" height="36"/><text class="label" x="360" y="238">edit file</text>
<rect class="box plain" x="500" y="220" width="200" height="36"/><text class="label" x="600" y="238">edit file</text>
</g>
<!-- old adjusting commit, crossed out and discarded in step 4 -->
<g class="anim oldout">
<rect class="box adjust" x="20" y="170" width="200" height="36"/><text class="label" x="120" y="188">git-annex adjusted branch</text>
</g>
<g class="anim crossin">
<line class="cross" x1="35" y1="173" x2="205" y2="203"/>
<line class="cross" x1="35" y1="203" x2="205" y2="173"/>
</g>
<!-- your commit on the adjusted branch; moves down in step 4, now as basis's copy -->
<g class="anim movedown">
<rect class="box yours" x="20" y="120" width="200" height="36"/><text class="label" x="120" y="133">edit file again</text>
<text class="anim subold label small" x="120" y="147">your commit: pointer</text>
<text class="anim subnew label small" x="120" y="147">copy from basis</text>
</g>
<!-- step 2: replay on top of basis -->
<g class="anim ghostmove">
<rect class="box yours" x="20" y="120" width="200" height="36"/><text class="label" x="120" y="138">edit file again</text>
</g>
<g class="anim in1">
<rect class="box yours" x="260" y="170" width="200" height="36"/><text class="label" x="360" y="183">edit file again</text>
<text class="label small" x="360" y="197">copy: symlink, new hash</text>
</g>
<path class="anim ar1 arrow" d="M222,138 C244,138 236,188 256,188"/>
<!-- step 3: master follows basis -->
<g class="anim in2">
<rect class="box yours" x="500" y="170" width="200" height="36"/><text class="label" x="600" y="183">edit file again</text>
<text class="label small" x="600" y="197">same commit as basis</text>
</g>
<path class="anim ar2 arrow" d="M462,188 L496,188"/>
<!-- step 4: new adjusting commit on top -->
<g class="anim newadj">
<rect class="box adjust" x="20" y="120" width="200" height="36"/><text class="label" x="120" y="133">git-annex adjusted branch</text>
<text class="label small" x="120" y="147">new: your current tree</text>
</g>
<path class="anim ar3 arrow" d="M258,180 C236,180 246,138 222,138"/>
<!-- captions, numbered like the steps in the text -->
<text class="anim cap0 caption" x="360" y="350">1. Your commit, a pointer to the new object, is on the adjusted branch.</text>
<text class="anim cap1 caption" x="360" y="350">2. git-annex replays it on top of basis (file as symlink).</text>
<text class="anim cap2 caption" x="360" y="350">3. master is set to the same commit as basis.</text>
<text class="anim cap3 caption" x="360" y="350">4. The old adjusting commit is dropped; a new one goes on top.</text>
<text class="anim cap4 caption" x="360" y="350">After: all three agree again.</text>
</svg>

After

Width:  |  Height:  |  Size: 7.9 KiB

View file

@ -0,0 +1,4 @@
<div style="min-width: 0;">
<p style="margin: 0 0 0.2rem; font-size: 0.8rem; opacity: 0.7;">{{ .Get "title" }}</p>
{{ .Inner }}
</div>

View file

@ -0,0 +1,3 @@
<div class="dlcols{{ if eq (string (.Get "single")) "true" }} dlcols-single{{ end }}">
{{ .Inner }}
</div>

View file

@ -0,0 +1,7 @@
{{- /* A collapsible block. Unlike Hugo's built-in details shortcode, it takes
an id, so that a link can point to the block. Wrap Markdown content in
{{% dlmd %}}, see dlmd.html. */ -}}
<details{{ with .Get "id" }} id="{{ . }}"{{ end }}>
<summary><strong>{{ .Get "summary" | markdownify }}</strong></summary>
{{ .Inner }}
</details>

View file

@ -0,0 +1,6 @@
{{- /* Renders its content as Markdown inside a dldetails block. dldetails uses
the standard {{< >}} notation, which does not render its content as Markdown;
wrapping the Markdown parts in {{% dlmd %}} (Markdown notation) does. Without
the wrapper, raw Markdown shows up; using {{% dldetails %}} instead makes the
whole block disappear, without a build error. */ -}}
{{ .Inner }}