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

git-town panics on branch rename #3538

Closed
breml opened this issue May 16, 2024 · 2 comments
Closed

git-town panics on branch rename #3538

breml opened this issue May 16, 2024 · 2 comments
Labels

Comments

@breml
Copy link

breml commented May 16, 2024

Steps to reproduce

  1. create branch (in this case, I created the branch without git-town: git checkout -b branch-name)
  2. commit on the newly created branch
  3. push the branch to origin
  4. rename the branch with git town rename-branch new-name (while still having the branch, that is renamed, checked out)

Command output

...

[new-name] git branch -D branch-name
Deleted branch branch-name (was 3eb5f4b6f).
panic: local branch names cannot be empty

goroutine 1 [running]:
github.com/git-town/git-town/v14/src/git/gitdomain.NewLocalBranchName(...)
        D:/a/git-town/git-town/src/git/gitdomain/local_branch_name.go:14
github.com/git-town/git-town/v14/src/config/gitconfig.AddKeyToPartialConfig({0xc0027a5e35, 0x35}, {0xc0027a5e35, 0x0}, 0xc000e4f1a8)
        D:/a/git-town/git-town/src/config/gitconfig/access.go:41 +0x183a
github.com/git-town/git-town/v14/src/config/gitconfig.(*Access).load(0xc000e4f458, 0x0, 0x0)
        D:/a/git-town/git-town/src/config/gitconfig/access.go:253 +0x556
github.com/git-town/git-town/v14/src/config/gitconfig.(*Access).LoadLocal(...)
        D:/a/git-town/git-town/src/config/gitconfig/access.go:32
github.com/git-town/git-town/v14/src/vm/interpreter/full.finished({0xc000170c18, {0x0, 0x0}, 0xc0000be428, 0x0, {{0xc000f24667, 0x1e}, {0xc0016d4008, 0xf0, 0x133}}, ...})
        D:/a/git-town/git-town/src/vm/interpreter/full/finished.go:25 +0x225
github.com/git-town/git-town/v14/src/vm/interpreter/full.Execute({0xc000170c18, {0x0, 0x0}, 0xc0000be428, 0x0, {{0xc000f24667, 0x1e}, {0xc0016d4008, 0xf0, 0x133}}, ...})
        D:/a/git-town/git-town/src/vm/interpreter/full/execute.go:20 +0x31a
github.com/git-town/git-town/v14/src/cmd.executeRenameBranch({0xc000038a70, 0x1, 0x1}, 0x0, 0x0, 0x0)
        D:/a/git-town/git-town/src/cmd/rename_branch.go:88 +0x458
github.com/git-town/git-town/v14/src/cmd.renameBranchCommand.func1(0xc000164608, {0xc000038a70, 0x1, 0x1})
        D:/a/git-town/git-town/src/cmd/rename_branch.go:52 +0x8a
github.com/spf13/cobra.(*Command).execute(0xc000164608, {0xc000038a40, 0x1, 0x1})
        D:/a/git-town/git-town/vendor/github.com/spf13/cobra/command.go:983 +0xaca
github.com/spf13/cobra.(*Command).ExecuteC(0xc00013c308)
        D:/a/git-town/git-town/vendor/github.com/spf13/cobra/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
        D:/a/git-town/git-town/vendor/github.com/spf13/cobra/command.go:1039
github.com/git-town/git-town/v14/src/cmd.Execute()
        D:/a/git-town/git-town/src/cmd/core.go:38 +0x619
main.main()
        D:/a/git-town/git-town/main.go:18 +0x1e


### Additional information

Git Town 14.2.0
@breml breml added the bug label May 16, 2024
@kevgo
Copy link
Contributor

kevgo commented May 18, 2024

Thanks for this detailed bug report! I'm in the middle of an effort to make the type checks much more strict, which should eliminate bugs like this one once and for all!

@kevgo
Copy link
Contributor

kevgo commented May 30, 2024

This bug was a result of too loose type handling. The new stricter type checking is implemented now, and as a side effect this bug seems to be fixed. Please comment or reopen if you still run into it with versions newer than 14.2.0. Thanks!

@kevgo kevgo closed this as completed May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants