git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Drake <sdrake@xnet.co.nz>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Add `[decorate]' configuration section.
Date: Fri, 26 Feb 2010 11:44:11 +1300 (NZDT)	[thread overview]
Message-ID: <alpine.LNX.2.00.1002261131190.19126@vqena.qenxr.bet.am> (raw)
In-Reply-To: <7vr5ojwy38.fsf@alter.siamese.dyndns.org>

Sorry for taking so  long to reply to your email, got destracted.
 
On Wed, 17 Feb 2010, Junio C Hamano wrote:
> Steven Drake <sdrake@xnet.co.nz> writes:
> 
> > This can be used to enable the display of ref names of commits that are
> > shown by log commands.  Each of the log commands (whatchanged, show,
> > reflog, and log) can be enable separately.
> >
> > e.g:
> > 	[decorate]
> > 		log
> > 		reflog
> 
> What is the reason to set these configuration differently except "because
> we can"? 

Basicly yes, but I did this when I was looking at what you said in a reply
about the "log.decorate" changes, I.E.

  On Tue, 16 Feb 2010, Junio C Hamano wrote:
  > I was not worried about what your change does.  I am worried about
  > protecting what the code after your change currently does from future
  > changes done by other people while you are not actively watching the
  > patches in flight on this list.

But that can easly be with the patch below.

> Also, if it is a good idea to allow setting them independently,
> you would need to make it easier for people who want to set them all to
> the same value, e.g. "[decorate] logfamily = short" or something.

Good Idea!

> I somehow find the older "log.decorate" much more natural and the changes
> from it to this version not worth it, but maybe it is just me.

I agree with you, I just thought having a single "[decorate]" section in the
config file was cleaner.  But nomater which way around it was done someone
would want t done the other way around.

--- >8 ---
Subject: [PATCH 1/1] log.decorate: future proofing against builtin-log.c changes

Instead of directly setting 'decoration_style' in git_log_config() we set
an intermediate variable, then for each of the commands we want
'log.decorate' to have an affect 'decoration_style' is set from the
intermediate.

This is to protect against future change to cmd_log_init() and how it is
used or the commands 'log.decorate' affects.

Signed-off-by: Steven Drake <sdrake@xnet.co.nz>
---
 builtin-log.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/builtin-log.c b/builtin-log.c
index 0afba31..91712e6 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -24,7 +24,7 @@
 static const char *default_date_mode = NULL;
 
 static int default_show_root = 1;
-static int decoration_style;
+static int default_decoration_style, decoration_style;
 static const char *fmt_patch_subject_prefix = "PATCH";
 static const char *fmt_pretty;
 
@@ -269,9 +269,9 @@ static int git_log_config(const char *var, const char *value, void *cb)
 	if (!strcmp(var, "log.date"))
 		return git_config_string(&default_date_mode, var, value);
 	if (!strcmp(var, "log.decorate")) {
-		decoration_style = parse_decoration_style(var, value);
-		if (decoration_style < 0)
-			decoration_style = 0; /* maybe warn? */
+		default_decoration_style = parse_decoration_style(var, value);
+		if (default_decoration_style < 0)
+			default_decoration_style = 0; /* maybe warn? */
 		return 0;
 	}
 	if (!strcmp(var, "log.showroot")) {
@@ -286,6 +286,7 @@ int cmd_whatchanged(int argc, const char **argv, const char *prefix)
 	struct rev_info rev;
 
 	git_config(git_log_config, NULL);
+	decoration_style = default_decoration_style;
 
 	if (diff_use_color_default == -1)
 		diff_use_color_default = git_use_color_default;
@@ -353,6 +354,7 @@ int cmd_show(int argc, const char **argv, const char *prefix)
 	int i, count, ret = 0;
 
 	git_config(git_log_config, NULL);
+	decoration_style = default_decoration_style;
 
 	if (diff_use_color_default == -1)
 		diff_use_color_default = git_use_color_default;
@@ -429,6 +431,7 @@ int cmd_log_reflog(int argc, const char **argv, const char *prefix)
 	struct rev_info rev;
 
 	git_config(git_log_config, NULL);
+	decoration_style = default_decoration_style;
 
 	if (diff_use_color_default == -1)
 		diff_use_color_default = git_use_color_default;
@@ -462,6 +465,7 @@ int cmd_log(int argc, const char **argv, const char *prefix)
 	struct rev_info rev;
 
 	git_config(git_log_config, NULL);
+	decoration_style = default_decoration_style;
 
 	if (diff_use_color_default == -1)
 		diff_use_color_default = git_use_color_default;
-- 
1.6.6

  parent reply	other threads:[~2010-02-25 22:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-17  8:22 [PATCH] Add `[decorate]' configuration section Steven Drake
2010-02-17 17:50 ` Junio C Hamano
2010-02-17 18:28   ` Re* " Junio C Hamano
2010-02-20 17:17     ` Heiko Voigt
2010-02-20 17:49       ` Thomas Rast
2010-02-22  5:52         ` Junio C Hamano
2010-02-25 22:44   ` Steven Drake [this message]
2010-02-25 23:12     ` Junio C Hamano
2010-02-26  0:06       ` Steven Drake
2010-02-26  3:57         ` Steven Drake

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.LNX.2.00.1002261131190.19126@vqena.qenxr.bet.am \
    --to=sdrake@xnet.co.nz \
    --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;
as well as URLs for NNTP newsgroup(s).