Skip to content

cargo-new ignores $GIT_TEMPLATE_DIR #5420

Open
@BenWiederhake

Description

cargo new also initializes git. Awesome! Git is configurable through environment variables. Awesome! So why does git, when invoked by cargo, suddenly stop listening to its environment?

Steps to reproduce / I tried this:

$ mkdir empty_reference_dir
$ export GIT_TEMPLATE_DIR=$(realpath empty_reference_dir)
$ cargo new newproject

Expected behavior / I expected to see this happen:
Absence of files/dirs .git/description, .git/hooks/, and .git/info/.
Or more generally: I expected the absence of the files usually found in /usr/share/git-core/templates

Actual behavior / Instead, this happened:
It seems like all files from /usr/share/git-core/templates were copied.

My best guess: Either cargo crafts its own "clean" environment (why should it?), or cargo's emulation of git is incomplete.

For reference: A simple git init works as I desire, i.e., it obeys GIT_TEMPLATE_DIR. So at least I'm sure I didn't have a brainfart there.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-gitArea: anything dealing with gitCommand-newS-blocked-externalStatus: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions