libgit2 icon indicating copy to clipboard operation
libgit2 copied to clipboard

Merge from upstream libgit2

Open orgads opened this issue 1 year ago • 20 comments

Is there a reason this fork isn't merged from upstream libgit2?

orgads avatar Jun 04 '24 19:06 orgads

It's unlikely I'll ever be making any change in this repo.

romkatv avatar Jun 04 '24 19:06 romkatv

Why not? And what about pushing your changes upstream? Is it feasible?

orgads avatar Jun 04 '24 19:06 orgads

Why not?

It's work.

And what about pushing your changes upstream? Is it feasible?

Might be feasible. I won't be doing it though.

romkatv avatar Jun 04 '24 19:06 romkatv

What will you do with repos that will use sha256 for instance? Or any other features that may affect the existing workflow.

orgads avatar Jun 04 '24 19:06 orgads

I most likely will do nothing.

romkatv avatar Jun 04 '24 19:06 romkatv

I'm willing to help with merging (in either direction). The question is if you're open for such a PR.

orgads avatar Jun 04 '24 19:06 orgads

Sure, if you send a clean PR, I'll merge it.

romkatv avatar Jun 04 '24 19:06 romkatv

Oh great :)

I'm on it then.

I got to it because I'm trying to debug why worktree doesn't work on Windows, and when I compiled gitstatus I had many compiler warnings coming from libgit2 :)

orgads avatar Jun 04 '24 19:06 orgads

FWIW, my personal advice would be to not use gitstatus. If I manage to muster enough will power for the final contribution to gitstatus/powerlevel10k, that would be getting rid of gitstatusd. Since the time I wrote it, git has been getting faster, so it's not as awfully slow to use git nowadays. The big advantage is that it won't require ongoing maintenance to stay on top of git development.

romkatv avatar Jun 04 '24 20:06 romkatv

Interesting. Is it possible to rerun the benchmarks you did back then, and see if upstream git (or libgit2) had closed the gap (especially on Windows, I'm concerned about fs performance and process spawning time on msys...)?

orgads avatar Jun 04 '24 20:06 orgads

Must be possible but it's work.

The good thing is that you can try various solutions for yourself and see whether plain git is fast enough for you.

romkatv avatar Jun 04 '24 20:06 romkatv

Sure, I'll give it a shot. Thanks for your responsiveness.

orgads avatar Jun 04 '24 20:06 orgads

Is there a way to switch between gitstatus and "git status" in powerlevel10k?

orgads avatar Jun 05 '24 06:06 orgads

There is POWERLEVEL9K_DISABLE_GITSTATUS=true but it incidentally also disables async git status computation. My remark above referencing the final contribution was about removing this coincidence.

romkatv avatar Jun 06 '24 07:06 romkatv

@romkatv I tried to proceed with this, but at least on Windows, it looks like gitstatusd is actually slower than git command-line (probably because MSYS indexing is different than Git for Windows, which is built on mingw64, and uses native paths).

The advantage of gitstatusd is that it works asynchronously, so the prompt appears immediately without delays, unlike command-line git.

How hard should it be to make git command-line async as well? If you believe it is feasible for someone without any experience with zsh (I do have experience with bash though), please give me some pointers and I can try to implement it.

orgads avatar Sep 21 '24 19:09 orgads

It's feasible for someone who's good at programming in general. It's not a small project though. I'm afraid I cannot give any pointers other than in the direction of the overall source code.

romkatv avatar Sep 21 '24 20:09 romkatv

For what it's worth, I've also been maintaing a forward port of this against evolving upstream, which should be visible here: https://github.com/ajrh1/libgit2/tree/romkatv-1.8.1

I did a very quick eyeball comparison just now against orgads tree. Leaving aside the deleted files, as my branch I'd tried to keep as a rebase of roman's individual commits so is similarly stripped down, the diff-filter=M changes look unsurprisingly very similar- I will likely go through the remaining diffs carefully to see which seems most correct.

I recognize the point about the whole being on life-support now and of questionable necessity if git has become faster, but I like the speed and greatly appreciate the work that Roman has put in.

ajrh1 avatar Oct 01 '24 02:10 ajrh1

Actually I'm not sure about my last comment regarding the speed difference. I switched back to gitstatusd, and it does feel faster than git. I'll need to do real benchmarks to compare them, but I don't know when I'll be able to do that.

orgads avatar Oct 09 '24 14:10 orgads

Is there a preferred place to continue this discussion? Don't want to keep raising notifications here if @romkatv you want to move on from the project. FWIW, I seem to have a working prototype of maintaining a single persistent gitstatusd rather than running one per shell, which seems to help a bit with Windows startup speed, and is aesthetically lighter. It's just a wrapper script that connects gitstatusd to a unix domain socket, and so I was thinking next to build the socket handling into gitstatusd. I wasn't sure originally how close to keep to the original style and backward compatibility, but if this repo is somewhat finalized then I'll maybe branch out a bit.

ajrh1 avatar Nov 11 '24 17:11 ajrh1

You can leave a link here so that others might find your fork, and then continue the discussion there.

FWIW, I've never went this path because the performance benefits are next to nothing, and the extra security concerns are non-trivial (think of users with different privileges having access to the same gistatusd).

romkatv avatar Nov 11 '24 17:11 romkatv