Git development
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Brian Foster <brian.foster@innova-card.com>,
	Junio C Hamano <gitster@pobox.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: [PATCH 3/4] Make '--decorate' set an explicit 'show_decorations' flag
Date: Mon, 3 Nov 2008 11:39:48 -0800 (PST)	[thread overview]
Message-ID: <alpine.LFD.2.00.0811031135410.3419@nehalem.linux-foundation.org> (raw)
In-Reply-To: <alpine.LFD.2.00.0811031133590.3419@nehalem.linux-foundation.org>


From: Linus Torvalds <torvalds@linux-foundation.org>
Date: Mon, 3 Nov 2008 11:23:57 -0800
Subject: [PATCH 3/4] Make '--decorate' set an explicit 'show_decorations' flag

We will want to add decorations without necessarily showing them, so add
an explicit revisions info flag as to whether we're showing decorations
or not.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---

Another really trivial preparatory patch. Instead of writing to a totally 
unused and pointless local variable (yeah, don't ask me why it does that, 
it's probably my brainfart from long ago), set a "revs->show_decorations" 
flag that we actually _use_ to decide if we want to show decorations or 
not when outputting logs.

This makes no semantic difference, since there are only two users of 
decorations:
 - format_decoration() which does everything by hand
 - show_decorations() that now looks at the flag that we set when we 
   preload them.

It _will_ matter in the next commit, though. Because soon we'll start 
loading decorations without actually wanting to necessarily show them!

 builtin-log.c |    3 +--
 log-tree.c    |    2 ++
 revision.h    |    1 +
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/builtin-log.c b/builtin-log.c
index 176cbce..82ea07b 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -28,7 +28,6 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,
 		      struct rev_info *rev)
 {
 	int i;
-	int decorate = 0;
 
 	rev->abbrev = DEFAULT_ABBREV;
 	rev->commit_format = CMIT_FMT_DEFAULT;
@@ -55,7 +54,7 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,
 		const char *arg = argv[i];
 		if (!strcmp(arg, "--decorate")) {
 			load_ref_decorations();
-			decorate = 1;
+			rev->show_decorations = 1;
 		} else if (!strcmp(arg, "--source")) {
 			rev->show_source = 1;
 		} else
diff --git a/log-tree.c b/log-tree.c
index cf7947b..5444f08 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -59,6 +59,8 @@ void show_decorations(struct rev_info *opt, struct commit *commit)
 
 	if (opt->show_source && commit->util)
 		printf(" %s", (char *) commit->util);
+	if (!opt->show_decorations)
+		return;
 	decoration = lookup_decoration(&name_decoration, &commit->object);
 	if (!decoration)
 		return;
diff --git a/revision.h b/revision.h
index 51a4863..0a1806a 100644
--- a/revision.h
+++ b/revision.h
@@ -54,6 +54,7 @@ struct rev_info {
 			rewrite_parents:1,
 			print_parents:1,
 			show_source:1,
+			show_decorations:1,
 			reverse:1,
 			reverse_output_stage:1,
 			cherry_pick:1,
-- 
1.6.0.3.616.gf1239d6.dirty

  reply	other threads:[~2008-11-03 19:41 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-03 13:39 [Q] Abbreviated history graph? Brian Foster
2008-11-03 14:20 ` Santi Béjar
2008-11-03 14:55   ` Santi Béjar
2008-11-03 15:46   ` Brian Foster
2008-11-03 16:08     ` Santi Béjar
2008-11-03 19:32 ` Linus Torvalds
2008-11-03 19:33   ` [PATCH 1/4] Add a 'source' decorator for commits Linus Torvalds
2008-11-03 19:35     ` [PATCH 2/4] revision: make tree comparison functions take commits rather than trees Linus Torvalds
2008-11-03 19:39       ` Linus Torvalds [this message]
2008-11-03 19:43         ` [PATCH 4/4] Add support for 'namespace' history simplification Linus Torvalds
2008-11-03 21:45           ` Santi Béjar
2008-11-03 22:05             ` Linus Torvalds
2008-11-03 22:34               ` Santi Béjar
2008-11-03 22:28           ` Robin Rosenberg
2008-11-04 21:33           ` Clemens Buchacher
2008-11-03 20:15   ` [Q] Abbreviated history graph? Linus Torvalds
2008-11-03 20:34     ` Linus Torvalds
2008-11-04  8:45     ` 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

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

  git send-email \
    --in-reply-to=alpine.LFD.2.00.0811031135410.3419@nehalem.linux-foundation.org \
    --to=torvalds@linux-foundation.org \
    --cc=brian.foster@innova-card.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox