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

refactor: deprecate util.find_git_ancestor #3507

Merged
merged 1 commit into from
Dec 14, 2024

Conversation

dundargoc
Copy link
Member

Work on #2079.

@dundargoc dundargoc closed this Dec 13, 2024
@dundargoc dundargoc deleted the refactor/find_git_ancestor branch December 13, 2024 20:52
@dundargoc dundargoc restored the refactor/find_git_ancestor branch December 14, 2024 12:21
@dundargoc dundargoc reopened this Dec 14, 2024
@dundargoc dundargoc force-pushed the refactor/find_git_ancestor branch 2 times, most recently from b60bbb3 to 1b2444c Compare December 14, 2024 12:37
@@ -393,4 +383,9 @@ function M.find_package_json_ancestor(startpath)
return vim.fs.dirname(vim.fs.find('package.json', { path = startpath, upward = true })[1])
end

--- @deprecated use `vim.fs.find('.git', { path = startpath, upward = true })[1]` instead
function M.find_git_ancestor(startpath)
return vim.fs.find('.git', { path = startpath, upward = true })[1]
Copy link
Member

Choose a reason for hiding this comment

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

use vim.fs.dirname to get parent dir of result { "/Users/mw/workspace/neovim/.git" }

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Considering this is a very common situation, maybe it is better to add parent = true to the filter table

Copy link
Member Author

@dundargoc dundargoc Dec 14, 2024

Choose a reason for hiding this comment

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

You mean we add parent as an option to vim.fs.find? But we already have vim.fs.root that does what we want, we just can't use it right now since we support 0.9. Eventually we can drop that and start using vim.fs.root, and won't need to adjust vim.fs.find.

@dundargoc dundargoc force-pushed the refactor/find_git_ancestor branch 4 times, most recently from 12f3c41 to 3d488da Compare December 14, 2024 13:07
@dundargoc dundargoc force-pushed the refactor/find_git_ancestor branch from 3d488da to 4d4de10 Compare December 14, 2024 13:09
@dundargoc dundargoc marked this pull request as ready for review December 14, 2024 13:13
@dundargoc dundargoc merged commit 12d163c into neovim:master Dec 14, 2024
11 checks passed
@dundargoc dundargoc deleted the refactor/find_git_ancestor branch December 14, 2024 16:24
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.

3 participants