Skip to content

cargo new and VSC inconsistency #13583

Closed as not planned
Closed as not planned
@Vrajs16

Description

@Vrajs16

Problem

In a intialized git repo, running cargo new parent/project creates a new git repository inside project if the parent folder is not already created. If the parent folder is already there then it doesn't create the git repository.

Steps

  1. Create a new folder and then inside it, run git init.
  2. Then run cargo new test1, you will see that the .git folder does not exist inside of test1
  3. Then run cargo new parent/test2, you will see that the .git folder does exist inside of parent/test2
  4. Then run cargo new parent/test3, you will see that the .git folder does not exist inside of parent/test3

After running the commands it should look like this:
image

Running step 2 should not create a .git folder but it does because the parent folder has not been created.
This also does the same thing if more than one parent

Possible Solution(s)

I am assuming that if the parent folder is not created, cargo intializes a repo, so the solution would be to not do that so that it is consistent with cargo new without a path

Notes

No response

Version

cargo 1.78.0-nightly (8964c8ccf 2024-02-27)
release: 1.78.0-nightly
commit-hash: 8964c8ccff6e420e2a38b8696d178d69fab84d9d
commit-date: 2024-02-27
host: aarch64-apple-darwin
libgit2: 1.7.2 (sys:0.18.2 vendored)
libcurl: 8.1.2 (sys:0.4.71+curl-8.6.0 system ssl:(SecureTransport) LibreSSL/3.3.6)
ssl: OpenSSL 3.2.1 30 Jan 2024
os: Mac OS 14.1.1 [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-gitArea: anything dealing with gitC-bugCategory: bugCommand-newS-triageStatus: This issue is waiting on initial triage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions