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

fix: setqflist("all") should respect change_base #1094

Merged
merged 1 commit into from
Aug 4, 2024

Conversation

xzbdmw
Copy link
Contributor

@xzbdmw xzbdmw commented Jul 20, 2024

If change_base is called, instead of run git status, run git diff against the changed base_commit.
Fix: #692

@@ -44,18 +45,27 @@ function M:command(args, spec)
return git_command(args1, spec)
end

--- @return string[]
function M:files_changed()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't pull the config into this file. Instead add the sha as an argument to this function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

--- @type string[]
local results = self:command({ 'status', '--porcelain', '--ignore-submodules' })
local results
if base then
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't work if base is :0.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When will base be :0?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When someone sets it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, it seems base will never be :0

if base == ':0' then

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't matter, it might not in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I add an additional check in both places, is that enough?

@lewis6991
Copy link
Owner

Commits needs squashing.

@xzbdmw xzbdmw force-pushed the setqflist_all branch 2 times, most recently from 349f76d to 72a71e0 Compare August 2, 2024 11:17
pass config.base as parameter to files_changed

check if base = ":0"
@lewis6991 lewis6991 merged commit 58bd9e9 into lewis6991:main Aug 4, 2024
6 checks passed
@lewis6991
Copy link
Owner

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can setqflist() consider the changed base?
2 participants