neogit icon indicating copy to clipboard operation
neogit copied to clipboard

Unable to push commit to Gerrit

Open dapc11 opened this issue 2 years ago • 0 comments

Description

According to Gerrit workflow described in https://gerrit-review.googlesource.com/Documentation/user-upload.html#_git_push, the user is supposed to push upstream like:

git push origin HEAD:refs/for/master

This is currently not possible to accomplish (as far as I know) with the current implementation of push. With the three choices we have p Push to pushremote # This bypasses Gerrits "magical" HEAD:refs/for/master u Push to upstream # This tries to push origin to master, which is not allowed in Gerrit e Push to elsewhere # This allows me to specify remote and target branch (?)

When going for the Push to elsewhere, i input "remote" as origin, which reflects the first part of the above Gerrit push command. And as "branch" I input HEAD:refs/for/master, which results in the following command, when pressing $ to get the Git command log:

git push origin master

My point is, that push to elsewhere doesn't seem to support specifying a "branch" containing ':' and '/'.

Am I approaching this wrong, and should be using any of the other options to push, rather than push to elsewhere?

Neovim version

NVIM v0.7.0 Build type: Release LuaJIT 2.1.0-beta3 Compiled by runner@fv-az316-460

Features: +acl +iconv +tui See ":help feature-compile"

system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: "/share/nvim"

Operating system and version

Any

Steps to reproduce

  1. nvim -nu minimal.lua
  2. make a change in a repository hosted by Gerrit
  3. enter neogit, e.g. :neogit
  4. stage change and commit
  5. try to push to Gerrit using the HEAD:refs/for/master branch.

Expected behavior

No response

Actual behavior

I think it's covered in the description.

Minimal config

vim.cmd([[set runtimepath=$VIMRUNTIME]])
vim.cmd([[set packpath=/tmp/nvim/site]])
local package_root = "/tmp/nvim/site/pack"
local install_path = package_root .. "/packer/start/packer.nvim"
local function load_plugins()
  require("packer").startup({
    {
      "wbthomason/packer.nvim",
      {
        "TimUntersberger/neogit",
        requires = {
          { "nvim-lua/plenary.nvim" },
          { "sindrets/diffview.nvim" },
        },
        config = function()
          print("loaded neogit")
          require("neogit").setup()
        end,
      },
    },
    config = {
      package_root = package_root,
      compile_path = install_path .. "/plugin/packer_compiled.lua",
      display = { non_interactive = true },
    },
  })
end
if vim.fn.isdirectory(install_path) == 0 then
  print("Installing neogit and dependencies.")
  vim.fn.system({ "git", "clone", "--depth=1", "https://github.com/wbthomason/packer.nvim", install_path })
end
load_plugins()
require("packer").sync()

dapc11 avatar Aug 31 '22 06:08 dapc11