Skip to content

Some feedback... #1

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

Open
palexdev opened this issue Mar 17, 2024 · 1 comment
Open

Some feedback... #1

palexdev opened this issue Mar 17, 2024 · 1 comment

Comments

@palexdev
Copy link

palexdev commented Mar 17, 2024

Hello, I just wanted to leave some feedback on this library.

Context

I'm developing a tool which needs Git functionalities. In particular, but not limited to, it has to clone a huge amount of repositories from different sources.
I started by using JGit but it's so bad it's almost ridiculous. Very often, clone operations are super slow and would end with a EOF exception. Of course, it does not happen with the native command.

Switching to SympleGit

Let's say that the README is quite catchy:

However, JGit's API comes with a learning curve and lacks direct, one-to-one support for CLI actions. Therefore, SympleGit is likely to be a more straightforward option for simple Git integration in many Java projects, particularly those utilizing basic Git functionalities. Let's delve into the details!

In my honest opinion, it cannot be more false. JGit is super easy to use, at least in my use case, every git command is a class in JGit. In SympleGit the clone command class does not exist.
The great thing about SympleGit is that it uses the native command to perform operations, which is so much faster and performant. The bad thing, again in my opinion, is that the API is not so well thought, and it's lacking.

  1. The idea of creating custom git commands with executeGitCommand(...) surely is good to cover all cases even those that are not implemented yet, but still having them implemented as classes would make everything much easier to use.
  2. It's so confusing to do this:
SympleGit sympleGit = SympleGit.custom()
    .setDirectory(repoDirectoryPath)
    .build();

Why do I have to give the directory here instead of giving it to the command directly? Like this for JGit:

CloneCommand cmd = new CloneCommand()
    .setDirectory(destDir.resolve(path).toFile())
    .setURI(url)
    .setRemote(remote)
    .setBranch(branch);
// In this case, destDir is the base dir in which I want to store all the projects
// path is the where I want to clone the repository, the last part of the path will be the name of the directory

I find it a bit more intuitive
3) I read the README multiple times, but I still don't know how I can track the progress of a command. Probably because, yet again, it's not very intuitive. By nature, working with Process and ProcessBuilder in Java is a cumbersome task, processing the output of a process properly is hard. And for this very reason, a library that uses such APIs should make it as easy as possible for the end user to use it.
The first thing that comes to my mind when I want to track the progress of an external process is something like this:

// I get the why of the check...
if (! gitCommander.isResponseOk()) {
    System.out.println("An Error Occured: " + gitCommander.getProcessError());
    return;
}

// Then...
while (command.output ...) {
// print output
}

JGit here is doing a far better job here, I can modify the above command like this:

CloneCommand cmd = new CloneCommand()
    .setProgressMonitor(new TextProgressMonitor()) // And boom, I automatically have output to the console
    .setDirectory(destDir.resolve(path).toFile())
    .setURI(url)
    .setRemote(remote)
    .setBranch(branch);
// Not only that, I can even make custom monitor implementations

Conclusion

I believe SympleGit could become a very good alternative to JGit, but it definitely needs to grow, improve and expand the API.
In the meantime, I think I'll implement a custom solution that uses the native command just like SympleGit because it's simply much much better than JGit which crashes all the time.

@ndepomereu
Copy link
Member

Hi,

Sorry for very late reply & thanks for the comments.

I was a bid dubitative, about why it's confusing to do that:

SympleGit sympleGit = SympleGit.custom()
    .setDirectory(repoDirectoryPath)
    .build();

Could you please elaborate a little? I'm not sure of the importance of the issue.

About the progress monitor, I clearly understand the need, but can you tel when it's important to set up monitor?
Maybe my projects are not big enough, I never had the need...

Of course, we will do it cleanly, extendable like you wish.

Best,
N.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants