Skip to content

Memoize detect_github_protocol to avoid repeated subprocess calls #109

Description

@raiderrobert

Context

In src/template/source.rs (lines 25-40), detect_github_protocol shells out to gh on every gh: abbreviation expansion:

fn detect_github_protocol() -> String {
    Command::new("gh")
        .args(["config", "get", "git_protocol", "-h", "github.com"])
        .output()
        ...
}

This also makes test behavior non-deterministic — tests must accept either SSH or HTTPS results.

Suggestion

Memoize with OnceLock or LazyLock so the subprocess is only called once per process.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions