Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Reading files from folder contents vs reading files from git ref #1303

spenserblack started this conversation in General
Discussion options

Using this discussion to list the pros/cons of reading from the folder (like tokei does) vs reading from a git ref (like linguist does). Feel free to comment or edit.

From git ref

From directory

You must be logged in to vote

Replies: 1 comment 9 replies

Comment options

Can we do HEAD + pending changes ?

You must be logged in to vote
9 replies
Comment options

o2sh Apr 9, 2024
Maintainer

But If It's easier, I wouldn't mind sticking to only considering tracked files at HEAD and adopting the GitHub Linguist approach entirely.

Comment options

Byron Apr 9, 2024
Collaborator

I'd like that, i.e. dropping the index approach which I'd find quite uncommon. Either everything in the worktree, sans .gitignored files, or everything in Git, but not a mix of that by considering the staging area. The difference of the staging area and the worktree probably also isn't big enough to warrant that.

Specifically, how the list of files and their contents would be different between the two. Would it be that reading from the index would implicitly use git built-in behavior (like .gitignore) instead of needing to explicitly do that e.g. via the ignore crate?

The index is a tree of a commit, and staged changes. This does indeed imply that .gitignored files aren't in there, as they are (typically) not added.

Comment options

spenserblack Apr 9, 2024
Collaborator Author

Ah, I see, thanks!

Your response reminded me of something I'd like to raise this for consideration:
In a dotfiles repository, it's not uncommon to ignore everything and add files with git add -f (this is what I do).

# .gitignore
*

This makes it harder to accidentally stage sensitive files and cleans up the git status output.
So, for certain repositories, reading the .gitignore might ignore too much.

Comment options

spenserblack Apr 20, 2024
Collaborator Author

Just checking: are we good to move forward with reading from HEAD?

Comment options

o2sh Apr 21, 2024
Maintainer

Yes, sounds good to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /