Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git_bcommits() erroneously displays an empty list #1055

Closed
mroavi opened this issue Jul 28, 2021 · 2 comments · Fixed by #1059
Closed

git_bcommits() erroneously displays an empty list #1055

mroavi opened this issue Jul 28, 2021 · 2 comments · Fixed by #1059
Labels
bug Something isn't working

Comments

@mroavi
Copy link
Contributor

mroavi commented Jul 28, 2021

Description

I configured git_bcommits() such that the command affects the repo containing the currently displayed buffer. I do so using the cwd option:

function M.git_bcommits()
	require("telescope.builtin").git_bcommits{
		cwd = vim.fn.expand("%:p:h"),
		layout_config = {
			prompt_position = "top",
		},
		sorting_strategy = "ascending",
	}
end

The problem is that if nvim's current working directory is not in the repo containing the current buffer, then this command displays an empty list of commits. If, however, the nvim's current working directory is inside the repo contain the current buffer, then the commits are displayed properly. This gif illustrates this:

Peek 2021-07-28 12-59_bcommits_empty_list

Expected Behavior

git_bcommits() should display the list of commits for the current buffer regardless of neovim's current working directory.

Actual Behavior

git_bcommits() displays an empty list when invoked outside of the repo containing the currently displayed buffer.

Details

Environment
  • nvim --version output:
NVIM v0.5.0
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc-11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/runner/work/neovim/neovim/build/config -I/home/runner/work/neovim/neovim/src -I/home/runner/work/neovim/neovim/.deps/usr/include -I/usr/include -I/home/runner/work/neovim/neovim/build/src/nvim/auto -I/home/runner/work/neovim/neovim/build/include
Compiled by runner@fv-az242-526
  • Operating system:
NAME="Manjaro Linux"
ID=manjaro
ID_LIKE=arch
BUILD_ID=rolling
PRETTY_NAME="Manjaro Linux"
ANSI_COLOR="32;1;24;144;200"
HOME_URL="https://manjaro.org/"
DOCUMENTATION_URL="https://wiki.manjaro.org/"
SUPPORT_URL="https://manjaro.org/"
BUG_REPORT_URL="https://bugs.manjaro.org/"
LOGO=manjarolinux
@caojoshua
Copy link
Contributor

I was able to repro. Provided an explanation and fix in the linked PR.

@mroavi
Copy link
Contributor Author

mroavi commented Jul 29, 2021

I tested your PR successfully: it solves the reported problem as far as I can tell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants