Skip to content

Commit

Permalink
fix: always open new status buffer for open command
Browse files Browse the repository at this point in the history
This is done to ensure the `cwd` is updated for the status buffer.

Fixes #668
  • Loading branch information
PriceHiller committed Jul 29, 2023
1 parent 656b40e commit 186e1b0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lua/neogit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ local open = function(opts)
opts.cwd = vim.fn.expand(opts.cwd)
end

if not opts.cwd then
opts.cwd = vim.fn.getcwd()
end

if not did_setup then
notification.create("Neogit has not been setup!", vim.log.levels.ERROR)
logger.error("Neogit not setup!")
Expand Down Expand Up @@ -77,7 +81,12 @@ local open = function(opts)
end
else
a.run(function()
status.create(opts.kind, opts.cwd)
if status.status_buffer then
vim.cmd(string.format("cd %s", opts.cwd))
status.refresh(true)
else
status.create(opts.kind, opts.cwd)
end
end)
end
end
Expand Down

0 comments on commit 186e1b0

Please sign in to comment.