git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/2] graph API: avoid printing unnecessary padding before some octopus merges

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 1, 2008, 21:50 UTC
Message-ID
<7vskvwakph.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<1212353818-7031-3-git-send-email-adam@adamsimpkins.net>
Adam Simpkins <adam@adamsimpkins.net> writes:
Show 36 quoted lines
> When an octopus merge is printed, several lines are printed before it to
> move over existing branch lines to its right.  This is needed to make
> room for the children of the octopus merge.  For example:
>
> | | | |
> | |  \ \
> | |   \ \
> | |    \ \
> | M---. \ \
> | |\ \ \ \ \
>
> However, this step isn't necessary if there are no branch lines to the
> right of the octopus merge.  Therefore, skip this step when it is not
> needed, to avoid printing extra lines that don't really serve any
> purpose.
>
> Signed-off-by: Adam Simpkins <adam@adamsimpkins.net>
> ---
>  graph.c |   13 ++++++++-----
>  1 files changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/graph.c b/graph.c
> index 332d1e8..0531716 100644
> --- a/graph.c
> +++ b/graph.c
> @@ -450,16 +450,18 @@ void graph_update(struct git_graph *graph, struct commit *commit)
>  	 * it never finished its output.  Goto GRAPH_SKIP, to print out
>  	 * a line to indicate that portion of the graph is missing.
>  	 *
> -	 * Otherwise, if there are 3 or more parents, we need to print
> -	 * extra rows before the commit, to expand the branch lines around
> -	 * it and make room for it.
> +	 * If there are 3 or more parents, we may need to print extra rows
> +	 * before the commit, to expand the branch lines around it and make
> +	 * room for it.  We need to do this unless there aren't any branch
> +	 * rows to the right of this commit.
Double negation like this is confusing, isn't it?

"We do not have to do this if there isn't any branch row to the right of this commit" may be better. "We need to do this only if there is a branch row (or more) to the right of this commit" would probably be better.

Other than that, the code looks sane to me.
Previous: Adam SimpkinsNext: Adam Simpkins
Message 10 of 12 in “log --graph: extra space with --pretty=oneline”
  1. Teemu LikonenMay 28, 2008
  2. Wincent ColaiutaMay 28, 2008
  3. Adam SimpkinsMay 29, 2008
  4. graph API: improve output for merge commits (option 1)Adam Simpkins, May 29, 2008
  5. graph API: improve output for merge commits (option 2)Adam Simpkins, May 29, 2008
  6. Teemu LikonenMay 29, 2008
  7. 0/2 graph API: improve printing of mergesAdam Simpkins, Jun 1, 2008
  8. 1/2 graph API: improve display of merge commitsAdam Simpkins, Jun 1, 2008
  9. 2/2 graph API: avoid printing unnecessary padding before some octopus mergesAdam Simpkins, Jun 1, 2008
  10. Junio C HamanoJun 1, 2008
  11. Adam SimpkinsJun 2, 2008
  12. Junio C HamanoJun 2, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.