Description
First, thank you very much for this awesome plugin! I would also like to contribute to this plugin, so I tried to fix the issue myself, but unfortunately, it didn’t work. That’s why I’m opening this issue to ask for help.
Is your feature request related to a problem? Please describe.
I want to open the commit popup in a custom working directory (cwd) to work with submodules. However, after reading the code, I noticed that if the popup command is used, the passed current working directory (CWD) is ignored. (line 176)
╭──────────────────────────────────────────────────────────────────────────────────────────╮
│ nvim/lazy/neogit/lua/neogit.lua │
│──────────────────────────────────────────────────────────────────────────────────────────│
│ 152 function M.open(opts) │
│ 153 local notification = require("neogit.lib.notification") │
│ 154 │
│ 155 if not did_setup then │
│ 156 notification.error("Neogit has not been setup!") │
│ 157 return │
│ 158 end │
│ 159 │
│ 160 opts = construct_opts(opts) │
│ 161 │
│ 162 local git = require("neogit.lib.git") │
│ 163 if not git.cli.is_inside_worktree(opts.cwd) then │
│ 164 local input = require("neogit.lib.input") │
│ 165 if input.get_permission(("Initialize repository in %s?"):format(opts.cwd)) then │
│ 166 git.init.create(opts.cwd) │
│ 167 else │
│ 168 notification.error("The current working directory is not a git repository") │
│ 169 return │
│ 170 end │
│ 171 end │
│ 172 │
│ 173 if opts[1] ~= nil then │
│ 174 local a = require("plenary.async") │
│ 175 local cb = function() │
│ 176 open_popup(opts[1]) │
│ 177 end │
│ 178 │
│ 179 a.void(function() │
│ 180 git.repo:dispatch_refresh { source = "popup", callback = cb } │
│ 181 end)() │
│ 182 else │
│ 183 open_status_buffer(opts) │
│ 184 end │
│ 185 end │
╰──────────────────────────────────────────────────────────────────────────────────────────╯
Describe the solution you’d like
I hope something like the code below will work:
neogit.open({ cwd = git_path, kind = "floating" })
Describe alternatives you’ve considered
Any other way to deal with git submodules would be appreciated. For example, in my current repository, I have a dotfiles git folder that contains a lazyvim git folder. When I open the git commit dialog directly, the CWD is always set to the dotfiles git repository, so I can’t commit changes in the lazyvim git repo