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

Log should list ALL commits from any branch similar to git log --all #55

Open
jelaniwoods opened this issue Apr 12, 2020 · 9 comments · Fixed by #62
Open

Log should list ALL commits from any branch similar to git log --all #55

jelaniwoods opened this issue Apr 12, 2020 · 9 comments · Fixed by #62
Assignees

Comments

@jelaniwoods
Copy link
Contributor

jelaniwoods commented Apr 12, 2020

Doesn't look like this is easy to do by default with the git gem.

The log method only supports a count paramater
https://github.com/ruby-git/ruby-git/blob/861eb71e1c266606eefacf7ebd4bee4f34bee5de/lib/git/base/factory.rb#L39-L42

The log_commits method supports a few flags, but not all.
https://github.com/ruby-git/ruby-git/blob/861eb71e1c266606eefacf7ebd4bee4f34bee5de/lib/git/lib.rb#L129-L137

https://github.com/ruby-git/ruby-git/blob/861eb71e1c266606eefacf7ebd4bee4f34bee5de/lib/git/lib.rb#L1022-L1034

@raghubetina
Copy link
Contributor

raghubetina commented May 1, 2020

Is it... could it be... time to

We may have to traverse the graph ourselves and draw it?

@jelaniwoods
Copy link
Contributor Author

@raghubetina I'm not sure how we'd do that using the gem at least. It doesn't seem possible to get the graph itself. Unless you're referring to building the graph by going to each branch and grabbing all the commits? That sounds... intense 😯

@raghubetina
Copy link
Contributor

raghubetina commented May 1, 2020

@jelaniwoods Yes indeed, that is what I was referring to. Traversing the graph ourselves — y'know, computer science stuff! Once every two years or so, there comes a chance to use it.

Commit by commit, if necessary. This is how git itself does it — each commit knows who its parent(s) is, and git follows that back to draw the log or graph.

I don't know what commands are available in the gem, but I speculate that we could simplify producing the graph with something like:

  • List all branches
  • For each branch, git log and save the list of commit SHAs
  • Find common commit SHAs
  • Merge the logs at those points

I also speculate that there are a bunch of JS libraries out there that can help draw the tree, once we have it in a suitable data structure.

Just spitballin' though.

@raghubetina
Copy link
Contributor

raghubetina commented May 18, 2020

@jelaniwoods Just checking in on this — any progress? I would like to do a session on how to jump back and forth between commits this week or next. I'm happy to pair on this one together.

@jelaniwoods
Copy link
Contributor Author

jelaniwoods commented May 18, 2020

@raghubetina I made some progress. I have a list of Hashes, where each Hash represents a branch. The Hash has a key for branch name, HEAD, and an Array of all the commit SHA's from the branch. I've combined them into one list of all commit SHAs but still need to find the HEADs of all branches and verify the order of the commits.

#62

@raghubetina
Copy link
Contributor

@jelaniwoods Okay. If we iterate over each branch and do a git log, would that give us the list of commits in the correct order?

@jelaniwoods
Copy link
Contributor Author

@raghubetina I assumed that would be the case, but either I made an error with the logic somewhere or --graph sorts it differently. The order I got was slightly different.

Screen Shot 2020-05-18 at 5 10 38 PM

@raghubetina
Copy link
Contributor

raghubetina commented Oct 8, 2020

@jelaniwoods Where do we stand on drawing all the branches simultaneously in web_git?

@jelaniwoods
Copy link
Contributor Author

@raghubetina ah! I didn't see this. I had paused this since last quarter. I believe the last issue to figure out is the order to create the branches, since the graphing library needs to create branches at specific times. I'll focus back on this.

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

Successfully merging a pull request may close this issue.

2 participants