Skip to content

Pushing failed when branch name contains forward slash #578

@wustho

Description

@wustho

Description

I named my branch fix/foobar, but when I pushed to upstream using neogit, it failed. And when I checked the log using $ neogit only run git push origin fix instead of git push origin fix/foobar.

Neovim version

NVIM v0.10.0-dev-46+ge23c6ebed
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3

Operating system and version

Kubuntu 22.04.2 LTS x86_64

Steps to reproduce

  1. Make a branch containing forward slash like: hotifx/bla/bla
  2. Commit
  3. Push using P followed by u

Expected behavior

Neogit should only split the string by forward slash once to pick the remote, i.e. origin/fix/foo/bar to origin, fix/foo/bar.

Actual behavior

Neogit seems to split by every forward slash. , i.e. origin/fix/foo/bar to origin, fix, foo, bar

Minimal config

{
    'NeogitOrg/neogit', dependencies = 'nvim-lua/plenary.nvim',
    cmd = { 'Neogit' },
    config = function()
      require('neogit').setup({
        signs = {
          -- { CLOSED, OPENED }
          -- section = { '▶', '▼' },
          -- item = { '▶', '▼' },
          section = { '', '' },
          item = { '', '' },
          hunk = { '', '' },
        },
        integrations = {
          diffview = true,
        },
      })
    end,
  },

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions