Skip to content

Commit 3204043

Browse files
committed
fix: handle git name and email restore independently
Previously stepRestoreGit only restored when both name and email were missing. Now each field is checked independently, fixing cases where only one was already configured.
1 parent c855ac1 commit 3204043

2 files changed

Lines changed: 97 additions & 3 deletions

File tree

AGENTS.md

Lines changed: 86 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ go vet ./... # Lint check
113113
Tag-driven. CI handles everything. **Never edit root.go for version bumps.**
114114

115115
```bash
116-
git tag v0.19.0
116+
git tag v0.24.0
117117
git push --tags
118118
# CI builds binaries with version injected via ldflags, creates GitHub release
119119
```
@@ -124,6 +124,91 @@ git push --tags
124124

125125
**When to release**: Only for user-facing changes (features, bug fixes, package updates). Skip for docs, AGENTS.md, CI config, test-only changes.
126126

127+
### Writing Release Notes (Changelog)
128+
129+
CI creates a release with a generic install-only body. After CI completes, update it with a proper changelog using `gh release edit`.
130+
131+
**Step 1: Gather commits since last release**
132+
133+
```bash
134+
PREV_TAG=$(git tag --sort=-v:refname | sed -n '2p')
135+
git log ${PREV_TAG}..HEAD --oneline
136+
```
137+
138+
**Step 2: Write the changelog**
139+
140+
Follow this exact format:
141+
142+
```markdown
143+
## What's New
144+
- **Feature name** — One sentence user-facing description (`openboot <command>`)
145+
- **Feature name** — One sentence user-facing description
146+
147+
## Improvements
148+
- **Area** — What changed and why users care
149+
150+
## Bug Fixes
151+
- **What was broken** — What's fixed now
152+
153+
## Installation
154+
155+
\`\`\`bash
156+
curl -fsSL https://openboot.dev/install | bash
157+
\`\`\`
158+
159+
## Binaries
160+
161+
| Platform | Architecture | Download |
162+
|----------|--------------|----------|
163+
| macOS | Apple Silicon (M1/M2/M3) | `openboot-darwin-arm64` |
164+
| macOS | Intel | `openboot-darwin-amd64` |
165+
```
166+
167+
**Rules:**
168+
169+
- Omit empty sections (no "Bug Fixes" if there are none)
170+
- Write for **users**, not developers. No internal refactors, no test-only changes
171+
- Each bullet is one line, starts with **bold name** — description
172+
- Include the CLI command if it's a new/changed command
173+
- Keep Installation and Binaries sections at the bottom (always)
174+
175+
**Step 3: Update the release on GitHub**
176+
177+
```bash
178+
gh release edit v0.24.0 --repo openbootdotdev/openboot --notes "$(cat <<'EOF'
179+
## What's New
180+
- ...
181+
182+
## Installation
183+
...
184+
EOF
185+
)"
186+
```
187+
188+
**Example (v0.24.0):**
189+
190+
```markdown
191+
## What's New
192+
- **Clean command** — Remove packages not in your config or snapshot (`openboot clean`)
193+
- **Full snapshot restore** — Importing a snapshot now restores git identity, Oh-My-Zsh theme, and plugins
194+
195+
## Improvements
196+
- **Brew & npm uninstall** — Internal support for package removal, used by `openboot clean`
197+
198+
## Installation
199+
200+
\`\`\`bash
201+
curl -fsSL https://openboot.dev/install | bash
202+
\`\`\`
203+
204+
## Binaries
205+
206+
| Platform | Architecture | Download |
207+
|----------|--------------|----------|
208+
| macOS | Apple Silicon (M1/M2/M3) | `openboot-darwin-arm64` |
209+
| macOS | Intel | `openboot-darwin-amd64` |
210+
```
211+
127212
## NOTES
128213

129214
- **macOS only**: No Linux/Windows support. darwin binaries only.

internal/installer/installer.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -761,13 +761,22 @@ func stepRestoreGit(cfg *config.Config) error {
761761
return nil
762762
}
763763

764+
nameToSet := existingName
765+
emailToSet := existingEmail
764766
if existingName == "" && git.UserName != "" {
765-
if err := system.ConfigureGit(git.UserName, git.UserEmail); err != nil {
767+
nameToSet = git.UserName
768+
}
769+
if existingEmail == "" && git.UserEmail != "" {
770+
emailToSet = git.UserEmail
771+
}
772+
773+
if nameToSet != existingName || emailToSet != existingEmail {
774+
if err := system.ConfigureGit(nameToSet, emailToSet); err != nil {
766775
return fmt.Errorf("failed to restore git config: %w", err)
767776
}
768777
}
769778

770-
ui.Success(fmt.Sprintf("Git restored: %s <%s>", git.UserName, git.UserEmail))
779+
ui.Success(fmt.Sprintf("Git restored: %s <%s>", nameToSet, emailToSet))
771780
fmt.Println()
772781
return nil
773782
}

0 commit comments

Comments
 (0)