Skip to content

Commit b836a3b

Browse files
committed
DOC: Clarify third-party fork conventions and de-duplicate update docs
Document the divergent/pruned fork type (vxl/VNL) where <sha7> is the overlay-tip commit and <version> is master, and require branch-only overlay anchors (a same-named branch and tag make the ref ambiguous and break update-third-party.bash). Make ThirdPartyForkConventions.md the single source of truth for fork naming and updating_third_party.md the source for procedure; cross-link them and drop the stale for/itk naming restatements. Route to both from AGENTS.md and fix the VNL README link that pointed at a nonexistent Maintenance/UpdatingThirdParty.md.
1 parent b3f7244 commit b836a3b

4 files changed

Lines changed: 58 additions & 14 deletions

File tree

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ the minimum set for the task at hand.
2525
| Creating a **COMP:** commit | [git-commits.md](./Documentation/AI/git-commits.md), [compiler-cautions.md](./Documentation/AI/compiler-cautions.md) |
2626
| Commit or PR attribution | [attribution.md](./Documentation/AI/attribution.md) |
2727
| Opening or updating a pull request | [pull-requests.md](./Documentation/AI/pull-requests.md), [attribution.md](./Documentation/AI/attribution.md) |
28+
| Updating a vendored ThirdParty dependency or its fork (eigen, DCMTK, VNL/vxl) | [ThirdPartyForkConventions.md](./Documentation/Maintenance/ThirdPartyForkConventions.md), [updating_third_party.md](./Documentation/docs/contributing/updating_third_party.md) |
2829

2930
## Critical Pitfalls
3031

Documentation/Maintenance/ThirdPartyForkConventions.md

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ Several ITK third-party dependencies are vendored from a fork hosted under the
55
organization (for example
66
[eigen](https://github.com/InsightSoftwareConsortium/eigen) and
77
[DCMTK](https://github.com/InsightSoftwareConsortium/DCMTK)). Each fork carries
8-
a small overlay of ITK-specific patches on top of an upstream release.
8+
an overlay of ITK-specific patches on top of an upstream baseline.
9+
10+
This document defines how those forks are *named and structured*. For the
11+
step-by-step procedure to update or initially port a dependency, see
12+
[Updating Third Party Projects].
913

1014
To keep these forks predictable and self-documenting, all ITK forks follow one
1115
convention.
@@ -25,13 +29,39 @@ Each overlay branch is named `for/itk-<project>-<version>-<sha7>` where:
2529

2630
- `<project>` is the forked project (e.g. `eigen`, `dcmtk`),
2731
- `<version>` is the upstream release the overlay is built on (e.g. `3.7.0`),
28-
- `<sha7>` is the 7-character commit hash of that upstream release tag.
32+
- `<sha7>` is the 7-character commit hash identifying the overlay's base
33+
(see the two fork types below).
2934

3035
For example, `for/itk-dcmtk-3.7.0-ccfd10b` carries the ITK overlay on top of
3136
upstream DCMTK tag `DCMTK-3.7.0` (commit `ccfd10b`). Older non-conforming
3237
branches are retained for historical reference but are no longer the update
3338
target.
3439

40+
### Two fork types
41+
42+
| Type | Examples | `<version>` | `<sha7>` |
43+
|------|----------|-------------|----------|
44+
| Release-tracking | `eigen`, `dcmtk` | upstream release (`3.7.0`) | the upstream release-tag commit |
45+
| Divergent / pruned | `vxl` (VNL) | `master` | the overlay-tip commit on the fork |
46+
47+
A release-tracking fork rebases a thin overlay onto each new upstream release,
48+
so `<sha7>` names the upstream commit the overlay sits on. A divergent fork has
49+
no upstream release to track — the `vxl` fork, for instance, is a pruned
50+
numerics-only subset whose only stable identifier is its own overlay tip — so
51+
`<version>` is `master` and `<sha7>` is the overlay-tip commit on the fork. The
52+
fork's `welcome` README states which type it is so the `<sha7>` provenance is
53+
unambiguous.
54+
55+
### Anchor overlay commits with branches, never tags
56+
57+
Each overlay commit ITK may pin is anchored by a **branch**; do **not** also
58+
create a tag with the same name. A ref that exists as both a branch and a tag
59+
(e.g. a branch and a tag both named `for/itk-vxl-master-fd75e8b`) is ambiguous:
60+
`git checkout`/`git fetch` of that name emits `warning: refname is ambiguous`
61+
and may resolve the wrong object, breaking `update-third-party.bash`. Protect
62+
each anchor branch against deletion and force-push so the pinned commit stays
63+
reachable as the moving branch advances.
64+
3565
## Pinning the fork in ITK
3666

3767
ITK pins a specific overlay commit, not a branch name, so the build is
@@ -43,4 +73,7 @@ reproducible:
4373

4474
When updating, the per-fork `welcome` branch is the authoritative, current
4575
description of the procedure; follow it, then update the corresponding pin in
46-
ITK and refresh the patch-list comment.
76+
ITK and refresh the patch-list comment. The general update and porting steps
77+
are in [Updating Third Party Projects].
78+
79+
[Updating Third Party Projects]: ../docs/contributing/updating_third_party.md

Documentation/docs/contributing/updating_third_party.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,21 @@ patches to the third party projects are tracked externally and available for
1010
Any updates to projects not listed there should first convert over to this
1111
framework.
1212

13+
This document covers the *procedure*. How each fork is named and structured
14+
(the `welcome` branch, the `for/itk-<project>-<version>-<sha7>` overlay branch
15+
naming, the two fork types, and the branches-not-tags anchor rule) is defined
16+
in [Third-Party Fork Conventions]. Follow that document for naming; follow this
17+
one for the mechanics.
18+
1319
Updating a Project
1420
------------------
1521

1622
Once converted, a project should be updated by applying patches to the
1723
repository specified in its `UpdateFromUpstream.sh` script. Once the upstream
1824
changes are merged, pulling the changes involves running the
1925
`UpdateFromUpstream.sh` script. This will update the local copy of the project
20-
to the version specified in `UpdateFromUpstream.sh` (usually a `for/foo`
21-
branch, like `for/itk` for example, but may be `main` or any other Git
26+
to the reference specified in `UpdateFromUpstream.sh` (an overlay branch named
27+
per [Third-Party Fork Conventions], but may be `main` or any other Git
2228
reference) and merge it into the main tree.
2329

2430
This requires a Git 2.5 or higher due the `worktree` tool being used to
@@ -92,12 +98,12 @@ to track it. If the upstream project does not use Git, it should be imported
9298
into Git (there may be existing conversions available on GitHub already). The
9399
project's description should indicate where the source repository lives.
94100

95-
Once a mirror of the project is created, a branch named `for/foo` should be
96-
created where patches for the `foo` project will be applied (i.e., `for/itk`
97-
for ITK's patches to the project). Usually, changes to the build system, the
98-
source code for mangling, the addition of `.gitattributes` files, and other
99-
changes belong here. Functional changes should be submitted upstream (but may
100-
still be tracked so that they may be used).
101+
Once a mirror of the project is created, an overlay branch named per
102+
[Third-Party Fork Conventions] should be created where patches for the project
103+
will be applied. Usually, changes to the build system, the source code for
104+
mangling, the addition of `.gitattributes` files, and other changes belong
105+
here. Functional changes should be submitted upstream (but may still be tracked
106+
so that they may be used).
101107

102108
The basic steps to import a project `foo` based on the tag `foo-3.0.0` looks
103109
like this:
@@ -109,8 +115,8 @@ git remote add insight git@github.com:InsightSoftwareConsortium/ITK.git:Modules/
109115
git push -u insight
110116
git push -u insight --tags
111117
git checkout foo-3.0.0
112-
git checkout -b for/itk
113-
git push --set-upstream insight for/itk
118+
git checkout -b for/itk-foo-3.0.0-<sha7> # see Third-Party Fork Conventions
119+
git push --set-upstream insight for/itk-foo-3.0.0-<sha7>
114120
```
115121

116122
Making the initial import involves filling out the project's
@@ -153,5 +159,6 @@ if necessary.
153159

154160

155161

162+
[Third-Party Fork Conventions]: https://github.com/InsightSoftwareConsortium/ITK/blob/main/Documentation/Maintenance/ThirdPartyForkConventions.md
156163
[update-third-party.bash]: https://github.com/InsightSoftwareConsortium/ITK/blob/main/Utilities/Maintenance/update-third-party.bash
157164
[update-third-party skill]: https://github.com/InsightSoftwareConsortium/ITK/blob/main/.github/skills/update-third-party/SKILL.md

Modules/ThirdParty/VNL/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,7 @@ Documentation about the library can be found at
66

77
https://vxl.github.io/
88

9-
See [UpdatingThirdParty.md](https://github.com/InsightSoftwareConsortium/ITK/blob/master/Documentation/Maintenance/UpdatingThirdParty.md) for details and instructions to update from upstream.
9+
See [Updating Third Party Projects](../../../Documentation/docs/contributing/updating_third_party.md)
10+
for instructions to update from upstream, and
11+
[Third-Party Fork Conventions](../../../Documentation/Maintenance/ThirdPartyForkConventions.md)
12+
for the fork branch-naming conventions.

0 commit comments

Comments
 (0)