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

Improve support of ignored files for file history #984

Open
fcollonval opened this issue Jul 27, 2021 · 1 comment · May be fixed by #1200
Open

Improve support of ignored files for file history #984

fcollonval opened this issue Jul 27, 2021 · 1 comment · May be fixed by #1200

Comments

@fcollonval
Copy link
Member

fcollonval commented Jul 27, 2021

In the file browser context menu, it is possible to request the file Git history through the submenu Git -> History. Unfortunately that entry is displayed for all files including those ignored by Git. It will be nice to know if a file is ignored to avoid displaying that entry for them.

Originally posted by @navn-r in #980 (comment)

@fcollonval
Copy link
Member Author

To tackle this one, the best is to make use of git check-ignore command as it supports to check for all elements within a directory; e.g.

❯ git check-ignore ./*
./build
./jupyterlab_git.egg-info
./lib
./node_modules
./__pycache__
./tsconfig.tsbuildinf

To achieve this, we need to implement:

  • in the backend:
    • in git.py#Git, add a new method check_ignore that execute git check-ignore -z <path> and parse the result to return the list of ignored files; changed_files method is a good example of a similar method.
    • in handlers.py#GitIgnoreHandler, add a get method that calls the new Git.check_ignore.
  • in the frontend:
    • in model.ts#GitExtension, add a isIgnored(path) method that will request the new GET endpoint.
    • in commandsAndMenu.tsx#addFileBrowserContextMenu,
      • we need to remove from the items = toArray(filebrowser.selectedItems()) the ignored files; I let you look at the code to figure out how to achieve that.

cc @sheezaaziz

@fcollonval fcollonval linked a pull request Dec 8, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant