mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
tools: check for Git repository in v doctor
(packaged V versions often lack a .git/ folder) (fix #24419) (#24420)
This commit is contained in:
parent
a1d94500e6
commit
4eed91eda1
1 changed files with 5 additions and 0 deletions
|
@ -237,6 +237,11 @@ fn (mut a App) cpu_info(key string) string {
|
|||
}
|
||||
|
||||
fn (mut a App) git_info() string {
|
||||
// Check if in a Git repository
|
||||
x := os.execute('git rev-parse --is-inside-work-tree')
|
||||
if x.exit_code != 0 || x.output.trim_space() != 'true' {
|
||||
return 'N/A'
|
||||
}
|
||||
mut out := a.cmd(command: 'git -C . describe --abbrev=8 --dirty --always --tags').trim_space()
|
||||
os.execute('git -C . remote add V_REPO https://github.com/vlang/v') // ignore failure (i.e. remote exists)
|
||||
if '-skip-github' !in os.args {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue