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

Why parent of a commit, is not a commit? #112

Open
ttben opened this issue Dec 17, 2017 · 3 comments
Open

Why parent of a commit, is not a commit? #112

ttben opened this issue Dec 17, 2017 · 3 comments

Comments

@ttben
Copy link
Contributor

ttben commented Dec 17, 2017

I was wondering why the parent field is a String instead of a commit?
I understand that building every Commit object for each commit is the analysed Git repository will be too heavy ; but a getCommit(String id) call may return a Commit object with another Commit instance as parent.
WDYT ?

@mauricioaniche
Copy link
Owner

Yes, @ttben, it's definitely due to performance reasons. The way RepoDriller works, we always need the parent commit to perform the diff. However, creating a Commit object for each parent can be too expensive (and, in most cases, not needed).

So, if you need it, you can get the Commit using the SCM that you also have in your visitor.

Does that answer your question?

@ttben
Copy link
Contributor Author

ttben commented Dec 17, 2017

Yes as it confirms that it is only for performance reasons.

The issue is that, for now, RepoDriller seems to handle (very very) well isolated analyses.
Eg.: find every commit that has a WORD in it, every commit of a given authors, etc

But if you want to analyse branches, relation between old a new commits, integrate the notion of evolution, you have to go back and forth between Commit and SCM.

I also worked with Rugged and its Walker. Commit have ids but a method parent can return a Commit object.

Maybe its just a utility method that performs the call to the SCM for the user?
Maybe different modes: isolated (current mode) or linked?

This is deeply rooted in the notion of a Commit, do we consider that a Commit doesn't know its branch nor its repository? Does it embed every single information from where it came from, or does the user has to go to the SCM to ask additional information about a given commit.

Sorry for the long text.
I'll try to be more concise next time ^^"

@mauricioaniche
Copy link
Owner

Thanks for your clear and concise explanation!

That's definitely doable! We could think of implementing it. Maybe in similar way to my new PR, #111, where one can configure which data to be loaded, and parent as a Commit object can be one of them!

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