sindresorhus/refined-github

Remove links for folders containing only a .gitkeep #2208

AlexejheroYTB posted onGitHub

<!-- Thanks for contributing! 🏓 -->

Suggestion

In some repos, there may be empty folders containing a .gitkeep file. This is usually done so that the folders appear in the repo, even though they dont contain any files (maybe the folders themselves store information in their name).

The link to open the folder is redundant because inside it there is only a 0 KB .gitkeep file.

Refind github could check if there is only one file in the folder and if it has 0 KB, and if that is the case, completely remove the link to open the folder.

Example URL

<!-- Please specify a URL where the feature should appear -->

https://github.com/AlexejheroYTB/Dlockly/tree/master/blocks/custom

Example of folder that this could apply to: 002 [sep]'

Images

This feature could look something like this:

image


Implementation suggestion:

  1. Watch for changes in the files list. Refer to the Hide Files extension suggested above, there’s good code for this in there.
  2. Fetch the contents of ALL the visible folders... using a single GraphQL query. Look for pre-existing features that do this: search api.v4 in our code
  3. For each folder that has a single file, change the link to point to that file.

It’s not an easy feature, but not a super complex one either.

posted by fregante over 5 years ago

This needs to ask info for every folder you ever see... just to possibly skip a click that you might not ever make. This is of limited use and not worth the complexity.

posted by fregante about 5 years ago

Fund this Issue

$0.00
Funded

Pull requests