Skip to content
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

pure go lib for git #481

Closed
vtolstov opened this issue Dec 26, 2016 · 22 comments
Closed

pure go lib for git #481

vtolstov opened this issue Dec 26, 2016 · 22 comments
Labels
type/enhancement An improvement of existing functionality type/feature Completely new functionality. Can only be merged if feature freeze is not active. type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@vtolstov
Copy link

vtolstov commented Dec 26, 2016

What do you think about https://github.com/src-d/go-git , i use it for some git operations like pull, clone and other and it works fine. As i know gogs work with git via adaptor package, so i can try to create replacement for git operations in pure go. Does this acceptable or not ?


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@tboerger
Copy link
Member

If it can entirely replace the git cli and doesn't depend on cgo I'm fine with that

@ekozan
Copy link

ekozan commented Dec 26, 2016

take care about the performance ;)

@JetpackDuba
Copy link

Why go-git instead of https://github.com/libgit2/git2go ? Imo libgit2 is really good

@tboerger
Copy link
Member

Because it requires cgo and libgit.

@lunny
Copy link
Member

lunny commented Dec 27, 2016

The first version of Gogs is based https://github.com/gogits/git. We have tried to use pure Go. But it developments slowly and run slower than git command. If the https://github.com/src-d/go-git is full-featured and almost the same performance with git command, I prefer that.

@lunny lunny added this to the 2.x.x milestone Dec 27, 2016
@lunny lunny added type/enhancement An improvement of existing functionality type/feature Completely new functionality. Can only be merged if feature freeze is not active. type/proposal The new feature has not been accepted yet but needs to be discussed first. labels Dec 27, 2016
@strk
Copy link
Member

strk commented Mar 20, 2017

It would be worth using an interface for git operations and support either pure-go implementation or libgit2, with a build tag. The sqlite backend is also cgit so I don't see why not allowing it in codebase...

@lunny
Copy link
Member

lunny commented Mar 20, 2017

Great idea, we indeed need an interface on go-gitea/gitea and let go-gitea/git become as the default implementation.

@bkcsoft
Copy link
Member

bkcsoft commented Apr 18, 2017

@lunny I'd rather put the interface in go-gitea/git and have the build-tag there TBH, otherwise we'd end up in a state where we need an interface in gitea, a wrapper for go-git and a wrapper for gitea/git

@lunny
Copy link
Member

lunny commented Apr 18, 2017

@bkcsoft How about mixed the two methods since https://github.com/src-d/go-git maybe not full-feature?

@bkcsoft
Copy link
Member

bkcsoft commented Apr 18, 2017

Hence the proposal for having both in the same repo (go-gitea/git), that way we can have commit_exec.go and commit_pure.go where we can, and only repo_merge_exec.go where src-d/go-git isn't usable 🙂

@strk
Copy link
Member

strk commented Apr 18, 2017 via email

@typeless
Copy link
Contributor

Continued from #1511

@strk

If I read correctly the code in its current version does not support merges ?

Yes.

See https://github.com/src-d/go-git
Also, are you suggesting to use this as one of the implementations of the go-gitea/git interface as proposed somewhere else or as the primary API for git work ?

My proposal was to use it as the primary API replacing go-gitea/git/
The approach using go-gitea/git as the interface is okay to me. But such abstraction can be eliminated in the long term.

Did you test performance compared to libgit ?

No. I assume it would have good, if not better, performance than other alternatives if the cgo overhead doesn't matter that much. But cgo does affect the developer experience to some extent.

@lunny
Copy link
Member

lunny commented Apr 19, 2017

A performance compare on a git sub command is welcome. For example, get releases page is too slow, if we use this library will retrieve better performance, it's great!

@bkcsoft
Copy link
Member

bkcsoft commented Apr 19, 2017

It should be fairly simple to test performance gains like this:

  • Add benchmark to current forking command
  • Add pure-go command with benchmarks
  • Run both benchmarks and compare

@filipnavara
Copy link
Contributor

Just a heads-up: I actually made some effort in this direction, it is discussed in issue #491 along with links to my code and some performance numbers.

@pjebs
Copy link

pjebs commented Oct 23, 2018

If I was to work on integrating gitea with https://github.com/src-d/go-git, where do I start?

@lunny
Copy link
Member

lunny commented Oct 23, 2018

@pjebs I think you could send PRs to https://github.com/go-gitea/git to instead git commands to pure go library. I think it's easier to do it step by step.

@typeless
Copy link
Contributor

typeless commented Oct 23, 2018

@pjebs Incrementally implementing the exported APIs of https://github.com/go-gitea/git seems to be a good idea.

@filipnavara
Copy link
Contributor

@pjebs Follow the suggestion by @typeless and @lunny. I already have a branch where I started doing that, so if you split the git module changes and gitea changes and help upstream it I'd be more than grateful. https://github.com/filipnavara/gitea/tree/perf-read

@pjebs
Copy link

pjebs commented Oct 23, 2018

Give me some time to understand the code base since I only found the repo a few days ago.
Then I'll look at starting the process.

@lunny
Copy link
Member

lunny commented Apr 21, 2019

@pjebs I think there are some part has used https://github.com/src-d/go-git and @filipnavara contributed a lot. You can go to modules/git to find them.

@6543
Copy link
Member

6543 commented Sep 7, 2020

since we use both (go-git and a git warper) and it doesn't look like go-git can take up for all git tasks I'll close this for now.
It can be reconsidered in the future if things change ...

@6543 6543 closed this as completed Sep 7, 2020
@lafriks lafriks removed this from the 2.x.x milestone Sep 14, 2020
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type/enhancement An improvement of existing functionality type/feature Completely new functionality. Can only be merged if feature freeze is not active. type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

No branches or pull requests