go-git
go-git copied to clipboard
Make first commit on repository that contain unreadable files lead to "Premission denied" error
- I have a repository that may contain an unreadable files.
- User that perform go-git commit do not have write permission on that repository(git directory should be created outside of worktree).
First of all I have removed createDotGitFile from setWorktreeAndStoragePaths which is the part of Init action of repository.go file. That is how I have avoided error that occure when user don't have write permission in worktree.
Since I know that repository may contain unreadable files, before committing I walk recursivelly through worktree and collect all unreadables and large files or symlinks to avoid adding them.
Once all accessible files were added i call Commit function and got error "open /path/to/unreadable/file: permission denied". I have added some debug to determine where exactly error appear.


22 days have passed and not a single answer, please explain, is this behavior correct in terms of compatibility with git? PS. I can always add file through "git add" even if there are unreadable files in the working directory