Skip to content

#1217 show git status for link targets, when no status on the link itself #1263

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

Merged
merged 2 commits into from
May 14, 2022

Conversation

alex-courtis
Copy link
Member

@alex-courtis alex-courtis commented May 14, 2022

closes #1217

naive attempt d81586e was ugly and duplicated logic, hence the refactor.

Priority for git status:

  1. link itself: added or untracked
  2. link target

Tested:

  • Dirty hard/soft link:
    • untracked
    • added
  • Clean soft link to:
    • file
    • folder
    • another link
  • Clean hard link to:
    • file
    • another hard link
  • Clean soft folder link:
    • open
    • closed
  • External modification and reload

@@ -2,8 +2,41 @@ local uv = vim.loop

local M = {}

local function get_dir_git_status(parent_ignored, status, absolute_path)
Copy link
Member Author

Choose a reason for hiding this comment

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

These could be public.

function M.has_one_child_folder(node)
return #node.nodes == 1 and node.nodes[1].nodes and uv.fs_access(node.nodes[1].absolute_path, "R")
end

function M.update_git_status(node, parent_ignored, status)
Copy link
Member Author

Choose a reason for hiding this comment

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

Could be moved to new module lua/nvim-tree/explorer/git.lua

Copy link
Member

@kyazdani42 kyazdani42 left a comment

Choose a reason for hiding this comment

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

nice refactor, i like this. Let's merge this as it is.

@kyazdani42 kyazdani42 merged commit f85af83 into master May 14, 2022
@kyazdani42 kyazdani42 deleted the 1217-git-status-for-symlinks-refactored branch May 14, 2022 07:34
Almo7aya pushed a commit to Almo7aya/nvim-tree.lua that referenced this pull request Oct 11, 2022
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.

Git Status For Symlinks
2 participants