Fix: Preserve timestamps during import (GH-121)

- Change validateBatchIssues() to only set timestamps if IsZero()
- Preserves historical timestamps from external systems (Jira, GitHub)
- Fixes dirty git repo after importing unchanged JSONL
- New issues still get current timestamps as before
- Add daemon.lock to .gitignore

Closes bd-55
Fixes #121

Amp-Thread-ID: https://ampcode.com/threads/T-e53c4a96-38dd-440a-9b8d-824992d33a40
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Steve Yegge
2025-10-23 09:40:08 -07:00
parent bdaf82026a
commit e4b0820449
3 changed files with 62 additions and 75 deletions

View File

@@ -665,8 +665,13 @@ func validateBatchIssues(issues []*types.Issue) error {
return fmt.Errorf("issue %d is nil", i)
}
issue.CreatedAt = now
issue.UpdatedAt = now
// Only set timestamps if not already provided
if issue.CreatedAt.IsZero() {
issue.CreatedAt = now
}
if issue.UpdatedAt.IsZero() {
issue.UpdatedAt = now
}
if err := issue.Validate(); err != nil {
return fmt.Errorf("validation failed for issue %d: %w", i, err)