cache `git config` output for repository to skip process calls
- Dominant language
- TypeScript
- Stars
- 21.8k
- Forks
- 10.5k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 25
Description
We have a number of places in the app where we read the config for a repository:
- check `protocol.version` before performing a `fetch/pull/push/clone`
https://github.com/desktop/desktop/blob/bee4c6bb74d8060c6514fad3ab6a3f366d4c8eaf/app/src/lib/git/core.ts#L325-L331
- check `trailer.separators` when extracting co-authors from a commit message
https://github.com/desktop/desktop/blob/bee4c6bb74d8060c6514fad3ab6a3f366d4c8eaf/app/src/lib/git/interpret-trailers.ts#L75-L79
- check `pull.rebase` to indicate what "pull" will do for the user
https://github.com/desktop/desktop/blob/bee4c6bb74d8060c6514fad3ab6a3f366d4c8eaf/app/src/lib/stores/git-store.ts#L339
These are run fairly often during typical usage of the app, and a way to optimize this could be:
- run a single `git config` and extract all key-value entries emitted by Git
- cache these values inside `GitStore` in some data structure
- refresh this cache on the same frequency as other repository data
- where an action requires configuration, pass in this state rather than launching an additional `git` process
Contributor guide
Assessment
This issue has not been assessed yet.