dolt
dolt copied to clipboard
`dolt branch -d` can't delete remote branches
I am running into an error when trying to remove a remote branch.
Reproduce
mkdir project
mkdir my_remote
cd project
dolt init
dolt remote add my_remote file://<path to my_remote>
dolt push --set-upstream my_remote master
dolt checkout -b mybranch
dolt push --set-upstream my_remote mybranch
rm -r .dolt
dolt clone file://<path to my_remote> .
dolt branch -r
dolt branch -dr mybranch
Expected result
The remote branch is deleted
Error received
panic: runtime error: slice bounds out of range [9:8]
goroutine 1 [running]:
github.com/dolthub/dolt/go/libraries/doltcore/ref.NewRemoteRefFromPathStr(0xc0000340d8, 0x8, 0x10, 0x7c4de5, 0x204c664, 0x204ce2c)
/src/libraries/doltcore/ref/remote_ref.go:80 +0x368
github.com/dolthub/dolt/go/libraries/doltcore/env/actions.DeleteBranch(0x2330660, 0xc00052e3f0, 0xc0004ba630, 0xc0000340d8, 0x8, 0xc000870100, 0xc00007e060, 0x2)
/src/libraries/doltcore/env/actions/branch.go:99 +0x305
github.com/dolthub/dolt/go/cmd/dolt/commands.handleDeleteBranches(0x2330660, 0xc00052e3f0, 0xc0004ba630, 0xc00052f110, 0xc000188540, 0xc00052f100, 0x2ef4460)
/src/cmd/dolt/commands/branch.go:288 +0x10d
github.com/dolthub/dolt/go/cmd/dolt/commands.deleteBranches(...)
/src/cmd/dolt/commands/branch.go:273
github.com/dolthub/dolt/go/cmd/dolt/commands.BranchCmd.Exec(0x2330660, 0xc00052e3f0, 0xc000206800, 0xb, 0xc00007e060, 0x2, 0x2, 0xc0004ba630, 0xb)
/src/cmd/dolt/commands/branch.go:125 +0x5a7
github.com/dolthub/dolt/go/cmd/dolt/cli.SubCommandHandler.Exec(0x2049d11, 0x4, 0x2060dd7, 0x11, 0xc0008f7400, 0x27, 0x27, 0x0, 0x2330660, 0xc00052e3f0, ...)
/src/cmd/dolt/cli/command.go:165 +0x4c2
main.runMain(0x0)
/src/cmd/dolt/dolt.go:297 +0x1250
main.main()
/src/cmd/dolt/dolt.go:132 +0x2e
Enviornment
- Windows10
- Dolt version 0.27.2
Great catch. We'll fix this.
Workaround for this is to push an empty ref to the remote branch:
dolt push origin :branchname