loco-rs / loco

🚂 🦀 The one-person framework for Rust for side-projects and startups
https://loco.rs
Apache License 2.0
4.96k stars 201 forks source link

loco new create project git error #500

Closed fan-tastic-z closed 6 months ago

fan-tastic-z commented 7 months ago

Description

❯ loco new
2024-03-16T09:31:20.931905Z ERROR loco_cli::git: git command returned an error error=Output { status: ExitStatus(unix_wait_status(32768)), stdout: "", stderr: "fatal: not a git repository (or any parent up to mount point /)\nStopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).\n" }
? ❯ App name? › Error: CTRL+C

I took a look. This should be used to determine whether the current directory is a git directory? But an error occurred when executing the git command

jondot commented 7 months ago

yep might be related to @assapir latest addition checks if a project is a "working directory" project. I guess one more precondition check was missing?

assapir commented 7 months ago

Hey @fan-tastic-z! How did you exactly run the command? Can you please give the exact steps to reproduce?

fan-tastic-z commented 7 months ago

@assapir

(base)  ~/dev/ loco -V 
loco-cli 0.2.6
(base)  ~/dev/ 
(base)  ~/dev/ loco new              
2024-03-19T02:06:31.309277Z ERROR loco_cli::git: git command returned an error error=Output { status: ExitStatus(unix_wait_status(32768)), stdout: "", stderr: "fatal: not a git repository (or any of the parent directories): .git\n" }
? ❯ App name? › myapp

In the current version, if you execute loco new in any directory to create a project, an error will be prompted. And when I tested version 0.2.5, I no longer had this error. This error occurred after upgrading to version 0.2.6.

RobertChang0722 commented 6 months ago

I create a PR to remove the error https://github.com/loco-rs/loco/pull/511

IMHO, I think that's not necessary to tracing::debug the information we expected.

We know the git -C destination_path rev-parse --is-inside-work-tree only got 2 cases. so just return Ok(false) is good and still keep the good feature to help user know the path with git or not

fan-tastic-z commented 6 months ago

thanks @RobertChang0722 I close this issue