jesseduffield / lazygit

simple terminal UI for git commands

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

branch recency is sometimes miscalculated

jorgheymans opened this issue · comments

Describe the bug
For a branch i just created, lazygit shows 1W

To Reproduce
Create a branch, then checkout the main branch again to see the age of branch.

Screenshots
image

Version info:
commit=3675570a391b1a49ddd198b4c7e71e17701d4404, build date=2024-03-23T09:09:11Z, build source=binaryRelease, version=0.41.0, os=linux, arch=amd64, git version=2.43.2

I suspect you sort your branches by date? In that case, lazygit shows the age of the tip commit of the branch, based on its committer date. I suspect that commit was simply made a week ago.

You can also sort your branches by recency, in that case the age shown is when you had the branch checked out last. In this case you'd expect to see 1m or something like that.

I prefer to sort by date rather than recency though, I find it more useful.

The last commit on that branch was just now, so that could not be it.

image

So you do sort by recency? Is the value correct if you sort by date?

Indeed, when sorting on date it's correctly showing 55m. But sorting on recency the indicator seems wrong then. There is only one commit on that branch. The branch was created just now, and i had it checked out upon creation.

OK, so there seems to be something wrong with the recency calculation. I'm sorry, but I don't care enough about this to look into it (too many other things to do). As I said, I recommend to sort by date (and I personally think it should be the default).

I agree it makes for a better default. I don't know why i had it set to recency. I checked other repositories I have and there the recency seems correct. Thanks for the feedback.