Skip to content

Commit d64a003

Browse files
authored
Merge pull request #8 from AriehSchneier/fix-tagmode-migration-section
docs: Fix TagMode migration direction in v5-to-v6 guide
2 parents 27f53e4 + 9934762 commit d64a003

File tree

1 file changed

+29
-17
lines changed

1 file changed

+29
-17
lines changed

src/tutorials/migrating-from-v5-to-v6.md

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Use this checklist to audit your codebase before upgrading:
2727
- [ ] Call `defer r.Close()` on every `*git.Repository` obtained from filesystem-backed operations
2828
- [ ] Remove the `isBare bool` positional argument from `git.PlainClone` calls; set `CloneOptions.Bare` instead
2929
- [ ] Update any explicit `git.AllTags` / tag-fetch logic — tags are **no longer fetched by default** on `Fetch`
30-
- [ ] Replace `plumbing.TagMode` references with `git.TagMode`
30+
- [ ] Update explicit `git.TagMode` type references to `plumbing.TagMode` (constant usage like `git.AllTags` is unchanged)
3131
- [ ] Rename `config.Version_0` / `config.Version_1` constants to `config.Version0` / `config.Version1`
3232
- [ ] Update code that implements or embeds `commitgraph.Index` — the interface gained `io.Closer` and new methods
3333
- [ ] Review any code that constructs `osfs` instances for `Plain*` operations — `BoundOS` is now the default
@@ -144,35 +144,47 @@ err := r.Fetch(&git.FetchOptions{
144144

145145
---
146146

147-
### 4. `plumbing.TagMode` moved to `git.TagMode` ✅ Merged
147+
### 4. `git.TagMode` moved to `plumbing.TagMode` ✅ Merged
148148

149-
**What changed:** The `TagMode` type and its constants (`AllTags`,
150-
`NoTags`, `InvalidTagMode`) have been moved from the `plumbing` package
151-
to the top-level `git` package.
149+
**What changed:** The `TagMode` type has been moved from the `git` package
150+
to the `plumbing` package. The `git` package still exports convenience
151+
constant aliases (`git.AllTags`, `git.NoTags`, etc.) that point to the
152+
underlying `plumbing` constants, so most code will continue to work without
153+
changes.
152154

153-
**Why:** `TagMode` is a concept that belongs to high-level clone/fetch
154-
options rather than the low-level plumbing layer.
155+
**Why:** `TagMode` will be used in the transport package and other low-level
156+
components, so it makes sense for it to be defined in `plumbing` alongside
157+
other shared types like `ReferenceName`.
155158

156-
**Impact:** Any explicit reference to `plumbing.TagMode`, `plumbing.AllTags`,
157-
or `plumbing.NoTags` will not compile.
159+
**Impact:** Minimal for most users. Code that uses `git.AllTags`,
160+
`git.NoTags`, etc. will continue to work unchanged. Only code that
161+
explicitly references the `git.TagMode` type (e.g., in function signatures or
162+
type assertions) will need updates.
158163

159164
**How to migrate:**
160165

161-
```go
162-
// v5
163-
import "github.com/go-git/go-git/v5/plumbing"
166+
For most usage (constants), no change needed:
164167

168+
```go
169+
// v5 and v6 — both work identically
165170
opts := &git.CloneOptions{
166-
Tags: plumbing.AllTags,
171+
Tags: git.AllTags,
167172
}
173+
```
174+
175+
If you explicitly reference the type:
176+
177+
```go
178+
// v5
179+
var mode git.TagMode = git.AllTags
168180

169181
// v6
170-
opts := &git.CloneOptions{
171-
Tags: git.AllTags,
172-
}
182+
var mode plumbing.TagMode = git.AllTags
183+
// or
184+
var mode plumbing.TagMode = plumbing.AllTags
173185
```
174186

175-
**References:** [go-git/go-git#910](https://github.com/go-git/go-git/issues/910)
187+
**References:** [PR #1300](https://github.com/go-git/go-git/pull/1300)
176188

177189
---
178190

0 commit comments

Comments
 (0)