Skip to content

cargo new --bin fails with default VCS #4173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
azdavis opened this issue Jun 15, 2017 · 7 comments
Closed

cargo new --bin fails with default VCS #4173

azdavis opened this issue Jun 15, 2017 · 7 comments

Comments

@azdavis
Copy link

azdavis commented Jun 15, 2017

$ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.12.5
BuildVersion:	16F73
$ rustc --version
rustc 1.18.0
$ cargo --version
cargo 0.19.0-dev (28d1d60 2017-05-16)
$ git --version
git version 2.13.1
$ find foo
find: foo: No such file or directory
$ cargo new --bin --verbose foo
error: Failed to create project `foo` at `/Users/azdavis/foo`

Caused by:
  [2/-3] could not find '' to stat: No such file or directory
$ find foo
foo
foo/.git
$ cargo new --bin --vcs none bar
     Created binary (application) `bar` project

Is there something I'm missing?

Thanks for your help.

@alexcrichton
Copy link
Member

Oh dear, sounds bad! Do you have a global ~/.gitconfig perhaps? Sometimes libgit2 tries to interpret that or errors there manifest in errors in Cargo.

@azdavis
Copy link
Author

azdavis commented Jun 15, 2017

I do have a global gitconfig (I actually keep mine at ~/.config/git/config).

The problem seems to be this: in my global gitconfig, I have init.templateDir = <the empty string>. This is because I didn't want git populating new git repositories with things like .git/description, .git/hooks/*.sample, and .git/info/exclude, none of which I need by default. And setting init.templateDir to the empty string seemed to have the same effect as making init.templateDir = <some path to a completely empty directory>, which is what I wanted.

This also could explain the error from Cargo about "could not find '' to stat."

I did a quick perusal of the git man pages to see if setting init.templateDir to the empty string is officially supported, but I couldn't find anything.

@alexcrichton
Copy link
Member

Ah ok, thanks for the clarification! We've had other bugs related to this in the past but this may just be a part of how libgit2 handles the templateDir option? The previous issue ended up getting fixed in libgit2, want to open a bug over there for this?

@azdavis
Copy link
Author

azdavis commented Jun 15, 2017

Sure: libgit2/libgit2#4271

@carols10cents
Copy link
Member

carols10cents commented Aug 30, 2017

update: there is a fix in libgit2 for this, but it doesn't look to me like libgit2 has done a release since then for libgit2-sys to upgrade to yet (libgit2-sys is currently at libgit2 15e1193, 0.26.0).

@dwijnand
Copy link
Member

I think this is fixed (in master) now:

  • the fix in libgit2 was a part of libgit2's v0.27.0-rc1 release,
  • git2 was upgraded to libgit2 0.27.0-rc2 in alexcrichton/git2-rs#303, which was a part of git2's 0.7.0 release,
  • cargo upgrade to git2 0.7.0 in Update git2 to 0.7.0 #5091

@alexcrichton
Copy link
Member

Awesome, thanks @dwijnand!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants