git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jay Soffian <jaysoffian@gmail.com>
Cc: Jeff King <peff@peff.net>, Miles Bader <miles@gnu.org>,
	git@vger.kernel.org
Subject: Re: orthogonal cases of log --date option
Date: Fri, 06 Mar 2009 00:02:10 -0800	[thread overview]
Message-ID: <7v1vtbw03h.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: 76718490903052258j277fa8e9g963deae1c3264a22@mail.gmail.com

Jay Soffian <jaysoffian@gmail.com> writes:

> On Fri, Mar 6, 2009 at 1:50 AM, Junio C Hamano <gitster@pobox.com> wrote:
>> Jeff King <peff@peff.net> writes:
>>
>>> Because from the user's perspective --foo={bar,baz,bleep} is about
>>> selecting exactly one of {bar,baz,bleep}.
>>
>> I do not feel very strongly about this either way, and without any prior
>> end user "Huh?" input, I would probably have argued like you myself, but
>> I saw the original message from Miles about giving more than one --date
>> and getting perplexed to see that it did not work, so...
>>
>> I am not likely to use --tz=Indian/Christmas myself; GMT and local might
>> however be useful in some situations, though.
>
> So I don't mind picking this up, but I'd like some guidance. There are
> two issues:
>
> 1) The CLI. You and Jeff don't seem to have an agreement here, but
> frankly, this is the easy part.
>
> 2) The internal implementation. Your implementation (enum -> bitfield)
> is clever, but Jeff seems to prefer what I suggested (going to a
> struct). The latter is quite a bit more work.

Is it?  Isn't it just the matter of doing something like this?

	struct date_mode {
        	enum {
                DATE_NORMAL = 0,
                DATE_RELATIVE,
                ...
                DATE_RAW
                } format;
                enum {
                DATE_ORIGINAL = 0,
                DATE_LOCAL
                /* perhaps ",DATE_GMT" later... */
                } tz_offset;
	};

	/* In revision.c::handle_revision_opt() */
        ...
	} else if (!strcmp(arg, "--date=local")) {
		revs->date_mode.format = DATE_NORMAL;
        	revs->date_mode.tz_offset = DATE_LOCAL;
	} else if (!prefixcmp(arg, "--date=")) {
        	revs->date_mode.format = parse_date_format(arg + 7);
	} else if (!strcmp(arg, "--tz=local")) {
        	revs->date_mode.tz_offset = DATE_LOCAL;
	}
	...

        /* In date.c::show_date() */
	...
        const char *show_date(unsigned long time, int tz, struct date_mode *mode_)
	{
        	int mode = mode_->format;

		if (mode_->tz_offset == DATE_LOCAL)
			tz = local_tzoffset(time);

		...
		/* and remove the existing
                if (mode == DATE_LOCAL)
                	tz = local_tzoffset(time);
		   that appears later in the code
		*/
	...

  reply	other threads:[~2009-03-06  8:03 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-03  8:18 orthogonal cases of log --date option Miles Bader
2009-03-03  8:34 ` Jeff King
2009-03-03  8:45 ` Junio C Hamano
2009-03-05 10:43   ` Jeff King
2009-03-05 21:04     ` Jay Soffian
2009-03-05 21:11       ` Jeff King
2009-03-05 22:21         ` Junio C Hamano
2009-03-06  5:23           ` Jeff King
2009-03-06  6:50             ` Junio C Hamano
2009-03-06  6:58               ` Jay Soffian
2009-03-06  8:02                 ` Junio C Hamano [this message]
2009-03-06  8:31                   ` Jay Soffian
2009-03-06  8:58                     ` Junio C Hamano
2009-03-06 12:12                       ` Jeff King
2009-03-06 12:10                 ` Jeff King
2009-03-06 12:09               ` Jeff King
2009-03-06  1:47     ` Miles Bader

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=7v1vtbw03h.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jaysoffian@gmail.com \
    --cc=miles@gnu.org \
    --cc=peff@peff.net \
    /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).