Skip to content

todotreeview: option to ignore all files not commited to git#22

Open
bf wants to merge 2 commits intodrmargarido:masterfrom
bf:patch-1
Open

todotreeview: option to ignore all files not commited to git#22
bf wants to merge 2 commits intodrmargarido:masterfrom
bf:patch-1

Conversation

@bf
Copy link

@bf bf commented Jan 22, 2025

adding option to ignore all files which have not been added to the git repo

adding option to ignore all files which have not been added to the git repo
@bf
Copy link
Author

bf commented Jan 22, 2025

This fixes an issue in lite-xl where PDF files which are in the project folder but not commited to the git repository would be scanned for the keywords. If a keyword like BUG was found the PDF binary data would be displayed in the UI, which is obviously not intended.

For me best heuristic was to discern between files which are commited to git and files which are not.

So now there is a setting where you can ignore all files which are not part of the git repository.

Copy link
Owner

@drmargarido drmargarido left a comment

Choose a reason for hiding this comment

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

Thanks for your PR. I added some comments with small requests for changes.

description = "Ignore all files which are not commited to the current git repository.",
path = "todo_only_files_from_git_repository",
type = "toggle",
default = true,
Copy link
Owner

Choose a reason for hiding this comment

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

This is very specific behaviour for your use case, set the default to false.


local git_files = {}
for relative_path_from_project_root in string.gmatch(file_list_str, "([^\n]+)") do
-- git_files[git_root .. PATHSEP .. relative_path_from_project_root] = true
Copy link
Owner

Choose a reason for hiding this comment

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

clear commented code


-- get list of all files in git repo
function TodoTreeView.get_all_files_in_git_repo()
-- local git_root = exec({"git", "rev-parse", "--show-toplevel"}):match( "^%s*(.-)%s*$" )
Copy link
Owner

Choose a reason for hiding this comment

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

clear commented code

todo_expanded = true,

-- Ignore all files which are not part of the git repository
todo_only_files_from_git_repository = true,
Copy link
Owner

Choose a reason for hiding this comment

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

Se default value to false

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.

2 participants