On Tue, Sep 01, 2015 at 03:16:50PM -0700, Junio C Hamano wrote:
> John Keeping <j...@keeping.me.uk> writes:
> 
> > This is Jeff's original patch with my fixup for DATE_STRFTIME squashed
> > in and a new change to reject "raw-local" (in both Documentation/ and
> > date.c).
> 
> Even in --date=raw, we do show the timezone offset, so I do not
> necessarily agree that raw-local is nonsensical.  That's the only
> difference between the one I queued yesterday and this one.

I suspect it depends on the interpretation of "raw"; the code currently
interprets raw to mean "exactly what exists in the commit/tag", in which
case converting it to the local timezone is wrong.  But the
documentation describes "raw" as "the raw Git %s %z format", and if we
interpret it to mean "Git's internal date format" then "raw-local" makes
sense.

The alternative would be the patch below as a preparatory step.

-- >8 --
diff --git a/date.c b/date.c
index f048416..345890f 100644
--- a/date.c
+++ b/date.c
@@ -175,12 +175,6 @@ const char *show_date(unsigned long time, int tz, const 
struct date_mode *mode)
        struct tm *tm;
        static struct strbuf timebuf = STRBUF_INIT;
 
-       if (mode->type == DATE_RAW) {
-               strbuf_reset(&timebuf);
-               strbuf_addf(&timebuf, "%lu %+05d", time, tz);
-               return timebuf.buf;
-       }
-
        if (mode->type == DATE_RELATIVE) {
                struct timeval now;
 
@@ -193,6 +187,12 @@ const char *show_date(unsigned long time, int tz, const 
struct date_mode *mode)
        if (mode->local)
                tz = local_tzoffset(time);
 
+       if (mode->type == DATE_RAW) {
+               strbuf_reset(&timebuf);
+               strbuf_addf(&timebuf, "%lu %+05d", time, tz);
+               return timebuf.buf;
+       }
+
        tm = time_to_tm(time, tz);
        if (!tm) {
                tm = time_to_tm(0, 0);
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to