git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Milton Soares Filho <milton.soares.filho@gmail.com>
To: git@vger.kernel.org
Cc: Milton Soares Filho <milton.soares.filho@gmail.com>
Subject: [PATCH] graph.c: visual difference on subsequent series
Date: Fri, 25 Oct 2013 18:51:27 -0200	[thread overview]
Message-ID: <1382734287-31768-1-git-send-email-milton.soares.filho@gmail.com> (raw)

For projects with separate history lines and, thus, multiple root-commits, the
linear arrangement of `git log --graph --oneline` does not allow the user to
spot where the sequence ends, giving the impression that it's a contiguous
history. E.g.

History sequence A: a1 -- a2 -- a3 (root-commit)
History sequence B: b1 -- b2 -- b3 (root-commit)

    git log --graph --oneline
    * a1
    * a2
    * a3
    * b1
    * b2
    * b3

In a GUI tool, the root-commit of each series would stand out on the graph.

This modification changes the commit char to a different symbol ('x'), so users
of the command-line graph tool can easily identify root-commits and make sense
of where each series is limited to.

    git log --graph --oneline
    * a1
    * a2
    x a3
    * b1
    * b2
    x b3

UPDATE: dealing with the mark at get_revision_mark() to address Junio C Hamano
concerns and give it a proper priority:

> It is unclear why the update goes to this function. At the first
> glance, I feel that it would be more sensible to add the equivalent
> code to get_revision_mark()---we do not have to worry about what
> else, other than calling get_revision_mark() and adding it to sb,
> would be skipped by the added "return" when we later have to update
> this function and add more code after the existing strbuf_addstr().
>
> The change implemented your way will lose other information when a
> root commit is at the boundary, marked as uninteresting, or on the
> left/right side of traversal (when --left-right is requested).  I
> think these pieces of information your patch seems to be losing are
> a lot more relevant than "have we hit the root?", especially in the
> majority of repositories where there is only one root commit.

Signed-off-by: Milton Soares Filho <milton.soares.filho@gmail.com>
---
 revision.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/revision.c b/revision.c
index 0173e01..ab0447f 100644
--- a/revision.c
+++ b/revision.c
@@ -3066,7 +3066,9 @@ char *get_revision_mark(const struct rev_info *revs, const struct commit *commit
 			return "<";
 		else
 			return ">";
-	} else if (revs->graph)
+	} else if (revs->graph && commit->parents == NULL)
+		return "x"; /* diverges root-commits in subsequent series */
+	else if (revs->graph)
 		return "*";
 	else if (revs->cherry_mark)
 		return "+";
-- 
1.8.1.2

             reply	other threads:[~2013-10-25 20:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-25 20:51 Milton Soares Filho [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-11-10 13:33 [PATCH] graph.c: visual difference on subsequent series Antoine Beaupré
2015-07-27 19:37 ` Antoine Beaupré
2015-07-27 20:17   ` Junio C Hamano
2015-09-03  8:04     ` Michael J Gruber
2015-09-03 17:13       ` Junio C Hamano
2015-09-04 14:07         ` Michael J Gruber
2015-09-04 16:08           ` Junio C Hamano
2013-10-25 16:07 Milton Soares Filho
2013-10-25 17:13 ` Junio C Hamano
2013-10-25 20:49   ` Milton Soares Filho
2013-10-26  2:37     ` Keshav Kini
2013-10-28 15:41       ` Junio C Hamano
2013-10-28 16:59         ` Keshav Kini
2013-10-28 17:18         ` Milton Soares Filho
2013-10-28 17:39           ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1382734287-31768-1-git-send-email-milton.soares.filho@gmail.com \
    --to=milton.soares.filho@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).