Skip to content
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

Problem relative path in init #27

Open
jaimeph opened this issue May 23, 2024 · 1 comment
Open

Problem relative path in init #27

jaimeph opened this issue May 23, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@jaimeph
Copy link
Contributor

jaimeph commented May 23, 2024

If you are in a project that contains subfolders and you want to start the gommitizen on a subfolder, it fails to specify the relative path.

For example:

jhalcon@LT13A-10009-I fc-helm-charts % tree ./
./
├── Makefile
├── README.md
├── charts
│   └── fc-app
│       ├── Chart.yaml
│       ├── README.md
│       ├── templates
│       │   ├── _helpers.tpl
│       │   ├── deployment.yaml
│       │   ├── hpa.yaml
│       │   ├── ingress.yaml
│       │   ├── service.yaml
│       │   └── serviceaccount.yaml
│       └── values.yaml
├── fc-pipelines.yaml
├── gommitizen-darwin-arm64
├── test.sh
├── test.yaml
└── test1.yaml

jhalcon@LT13A-10009-I fc-helm-charts % ./gommitizen init -d charts/fc-app
panic: Error obtaining the relative path: Error getting the relative path: Rel: can't make charts/fc-app/.version.json relative to /Users/jhalcon/Projects/fc-helm-charts

goroutine 1 [running]:
gommitizen/version.NewVersionData({0x10281aa9b, 0x5}, {0x10281aaa0, 0x5}, {0x140000c27c0, 0x1b}, {0x0?, 0x0?})
	/github/workspace/version/version.go:75 +0x1b8
gommitizen/cmd.initialize({0x16d777742?, 0xd?}, {0x0, 0x0})
	/github/workspace/cmd/init.go:40 +0xd4
gommitizen/cmd.glob..func2(0x140000cc400?, {0x10281a927?, 0x4?, 0x10281a92b?})
	/github/workspace/cmd/init.go:23 +0x8c
github.com/spf13/cobra.(*Command).execute(0x102a085a0, {0x140000ca2a0, 0x2, 0x2})
	/go/pkg/mod/github.com/spf13/[email protected]/command.go:987 +0x814
github.com/spf13/cobra.(*Command).ExecuteC(0x102a08880)
	/go/pkg/mod/github.com/spf13/[email protected]/command.go:1115 +0x344
github.com/spf13/cobra.(*Command).Execute(...)
	/go/pkg/mod/github.com/spf13/[email protected]/command.go:1039
gommitizen/cmd.Execute()
	/github/workspace/cmd/root.go:26 +0x24
main.main()
	/github/workspace/main.go:6 +0x1c

It works using the absolute path.

Is it a bug?

@jaimeph jaimeph added the bug Something isn't working label May 23, 2024
@sergiotejon
Copy link
Contributor

It's possible. I usually make a gommitizen init inside the folder where I want to keep the .version file. An easy fix could be remove the '-d' flag in init :)...

@sergiotejon sergiotejon self-assigned this Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants