On Friday, January 18, 2019 12:03:40 PM MST Junio C Hamano wrote:
> It is a shame that you introduced a nicely reusable get_time()
> mechanism to let external callers of show_date() specify what time
> to format, instead of the returned timestamp of gettimeofday(),
> but limited its usefulness to only testing "human" format output.
> If somebody wants to extend "test-tool date" for other formats, they
> also have to add a similar "show_date_XXX" hack for their format.
> 
> How about doing it slightly differently?  E.g.
> 
>  - Get rid of show_date_human().
> 
>  - Keep get_time(), but have it pay attention to GIT_TEST_TIMESTAMP
>    environment variable, and when it is set, use that as if it is
>    the returned value from gettimeofday().
> 
>  - If there are gettimeofday() calls in date.c this patch did not
>    touch (because they were not part of the "human-format"
>    codepath), adjust them to use get_time() instead.
> 
>  - Have "test-tool date" excersize show_date() directly.
> 
I did follow the pattern set for relative (which is why I created 
show_date_human() to mimic show_date_relative() ) as had been suggested.   I 
like this pattern better.

Why don't I create a second patch set after I git this one to next for 
relative to match your suggestion.  I don't like the idea of conflating two 
topics.

sps


Reply via email to