-
-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show branch track stats for active branches #34
Conversation
Looks like quite some progress, amazing! I seem to hit the TODO in |
The way I implement this is to compare two branches locally, just like running command
|
I agree, gitty should always operate read-only. An "out-of-sync" indicator may be good enough. We could probably also show the diff-stats from what we can gather locally in such scenarios, even if it may not be fully accurate. |
76905a3
to
30f5734
Compare
After some benchmark, I realized that current implementation using |
Now it should be fast enough. |
I've replaced For the second problem, please run |
I don't necessarily think it's a bad idea, but I guess the thing that currently confuses me is that I see the arrows for some branches, but not others. This may be related to my second problem (below) tho!
The last commit on GitHub is bd92dc1, which should result in an up-arrow being displayed. I'll try to debug this locally. |
It seems like your local branch is not tracking any remote branch. It would be like
in |
That's indeed correct and now it's fairly obvious what's happening. With that being said, I often use git like that and push/pull from specific branches as I see fit. I wonder if we should try to match the branch by name in such scenarios. |
@RangerCD I've now set up my branch to track the remote branch and it's mostly working fine. Nice work! I do however see a down arrow for that branch, even tho |
I'm not sure which direction should be used. Active branch is basically a remote branch, commit message is also from the remote branch. In this opinion, "ahead" in track stat means remote is ahead of local, which is opposite to regular "ahead". |
Yeah, I can see that reasoning, and I guess it depends a bit on the perspective. I guess I fear the inverted lingo may be confusing a lot of people who use |
Consistency is important indeed, I've reverse the direction in latest commit. |
Great work! Once again, thank you so much, @RangerCD! |
This PR will add track stat after branch name for each active branch:
Each track stat has 2 parts:
Stat indicator
β
β»
git fetch
Ahead/behind metrics
In format of
xxxβxxxβ
, corresponding togit rev-list --left-right --count <local branch>...<remote branch>
.Some special cases:
0
, number will be hiden99
will be shown as99+
0
, arrows are shown in greenβ
, nothing shows hereβ»
, metrics are not accurate unlessgit fetch
updates remote branch referenceTODO:
0β0β
with a different symbolgit rev-list
)