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

Allow selecting a sub-tree to draw instead, based on refspecs #55

Open
stdedos opened this issue Sep 13, 2022 · 3 comments
Open

Allow selecting a sub-tree to draw instead, based on refspecs #55

stdedos opened this issue Sep 13, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@stdedos
Copy link

stdedos commented Sep 13, 2022

Allow a vararg listing of refspecs, and visualize all n-1 refspecs with regards to the merge-base of the 1st refspec.

Or, in lay-mans terms: I have a main and two branches that were incrementally merged to main. I'd like the subgraph that tracs merge-base of all of the aforementioned refspecs on the bottom, the origin/main on top, and in-between the paths that those branches create with regards to main.

tl;dr:

$ git-graph master A B
 ○<──┐                  cf43da7 (HEAD -> master, origin/master) Merge branch 'A' into 'master'
 ○<┐ │                  ddcfb2d Merge branch 'B' into 'master'
 │ ● │                  bcfb676 (B) ...
 │ │ ●                  019ae78 (A) ,,,
 ├─┴─┘ 
 ○                      9cca380 Merge branch 'X' into 'master'
$

Workarounds considered: git-graph -n 3, but -n 3 is not like git log -3: git-graph simply stops drawing at the 3rd line, instead of parsing+drawing HEAD~3... If you have a branch that's newer than the (origin/)master, then (origin/)master is not even visible

@KarlHeitmann
Copy link

Let me see if I understand. You want to narrow down the graph to scope the list of refspecs you passed as argument, right?

master A B

Draw the place where they diverged at the bottom of the graph, and draw the place where they merged at the top. Don't draw anything else. Just see the related commits.

I've seen on the code that it is using a walker to navigate the commits of the repository. I've started this git_explorer project because I wanted to do something like you want: I'd like a tool to interactively draw the commits in a terminal and expand/collapse branches. But then I found this project that is much more advanced than mine.

We need to investigate if there is a way to tell the walker to stop navigating if it founds the conditions you described, and to not draw commits that don't belong to the branches you passed as argument. If you have a resource please share it to see what can I do.

@mlange-42
Copy link
Owner

@KarlHeitmann I think I do not really understand what the OP suggests/requests here.

@stdedos
Copy link
Author

stdedos commented Jul 6, 2023

Hello @mlange-42,

My suggestion is to create a localized graph visualization that focuses only on the specific refspecs (references to commits, branches, or tags in Git) that are provided as arguments.

In my example, git-graph master A B would only display the commits related to the master, A, and B branches. The bottom of the graph would mark the point where these branches diverged (based on a common ancestor or 'merge-base') and the top would show where they merged. All other branches or commits that are not related to master, A, or B would be excluded from the graph.

This request arises from a desire to simplify the graph visualization, making it easier to track the relationship and evolution of specific branches, especially in complex repositories with many branches.

The challenge is that the current graph-drawing mechanism doesn't have a way to restrict or scope the graph to these specific branches or refspecs, and stops drawing at the nth line rather than parsing and drawing up to the nth commit.

Hope this explanation helps!

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

No branches or pull requests

3 participants