- 
  Notifications
 You must be signed in to change notification settings 
- Fork 300
Reading files from folder contents vs reading files from git ref #1303
-
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
- Read from bare repo (Bare repository support #1299 )
- Read only tracked files (a user scanned a dotfiles repo and was surprised that a bunch of untracked .gofiles (probably from~/go/) were included) (Support analysis of tracked files #1033 )
From directory
- Read untracked files (Switch to gengo #1152 (comment) )
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment 9 replies
-
Can we do HEAD + pending changes ?
Beta Was this translation helpful? Give feedback.
All reactions
-
But If It's easier, I wouldn't mind sticking to only considering tracked files at HEAD and adopting the GitHub Linguist approach entirely.
Beta Was this translation helpful? Give feedback.
All reactions
- 
 👍 1
-
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 theignorecrate?
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.
Beta Was this translation helpful? Give feedback.
All reactions
- 
 👍 1
-
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.
Beta Was this translation helpful? Give feedback.
All reactions
- 
 👍 1
-
Just checking: are we good to move forward with reading from HEAD?
Beta Was this translation helpful? Give feedback.
All reactions
- 
 👍 1
-
Yes, sounds good to me
Beta Was this translation helpful? Give feedback.
All reactions
- 
 👍 1