Skip to content

ecc_import.go: copyFile/expandHome duplicate internal/registry/registry.go's helpers #87

Description

@ikeikeikeike

Surfaced by retrospective review of merged PR #30.

`internal/cli/ecc_import.go`'s `copyFile` (atomic: writes through a `.tmp` file then renames) and `expandHome` reimplement helpers that already existed in `internal/registry/registry.go` (added 2026-06-14, 11 days before PR #30 merged) — except `internal/registry`'s `copyFile` is a plain ReadFile+WriteFile with no atomic rename, so two different robustness levels for "copy a file" now coexist in the same binary. The same `expandHome` duplication pattern recurred a third time in `internal/gitwt/gitwt.go` four days after PR #30 merged, showing the lack of one shared, exported helper keeps costing a re-implementation.

Not folded into the wave-4 sweep's other ecc_import.go fixes because reconciling the two robustness levels is a design decision (which callers can tolerate a torn write vs which need atomicity, and where the shared helper should live) rather than a narrow bug fix — worth doing deliberately rather than as a drive-by.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions