You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
git ls-remote --symref origin HEAD
ref: refs/heads/master HEAD
28c8d9f868eb9af98618407170da6a63c43e7f62 HEAD
git ls-remote --symref origin HEAD
ref: refs/heads/main HEAD
597b74a4a04c8741db1000901627745b65e5d69a HEAD
The problem with this way is: It takes a while to get this from remote, like (~ 2000ms) so it's better
to create a cache file in the home directory (e.g. $HOME/.cache/git-substatus/cache.json)
to make the process faster.
The risk of caching is that the repository name isn't failproof as it may be replaced with another repository having the same name. That's why need to find a unique identifier for it?
The caching invalidation can happen every week (168h) and on every time when git-substatus is called with the --fetch option.
TODO:
Detect default branch in a repository
Display a visual cue if it's checked out to a non default branch
Write unit tests (e.g. repos which default branch name isn't master)
(Optional) Implement a caching mechanism to retrieve default branch information faster
The text was updated successfully, but these errors were encountered:
Show a different color and/or add a symbol to the branch column (like
*
) unless it shows the default branch name (mostlymaster
,main
,release
etc.).Unfortunately, this issue is a bit complex as there's no standard way of getting the default branch name right away.
Programmatically, it's possible to get the branch name in multiple ways:
1. If default branch is set in git config
2. If the repo was downloaded with git clone
then
origin/HEAD
is set automatically.3. Get from the remote
The problem with this way is: It takes a while to get this from remote, like (~
2000ms
) so it's betterto create a cache file in the home directory (e.g.
$HOME/.cache/git-substatus/cache.json
)to make the process faster.
Example cache file:
The risk of caching is that the repository name isn't failproof as it may be replaced with another repository having the same name. That's why need to find a unique identifier for it?
The caching invalidation can happen every week (
168h
) and on every time whengit-substatus
is called with the--fetch
option.TODO:
master
)The text was updated successfully, but these errors were encountered: