[2/2] test_date.c: Remove reference to GIT_TEST_DATE_NOW
diff mbox series

Message ID 20190909014711.3894-3-ischis2@cox.net
State New
Headers show
Series
  • Date test code clean-up
Related show

Commit Message

Stephen P. Smith Sept. 9, 2019, 1:47 a.m. UTC
Remove the reference to the GIT_TEST_DATE_NOW which is done in date.c.
The intialization of variable x with the value from GIT_TEST_DATE_NOW
is unneeded since x is initalized by skip_prefix().

Signed-off-by: Stephen P. Smith <ischis2@cox.net>
---
 t/helper/test-date.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Jeff King Sept. 9, 2019, 5:29 p.m. UTC | #1
On Sun, Sep 08, 2019 at 06:47:11PM -0700, Stephen P. Smith wrote:

> Remove the reference to the GIT_TEST_DATE_NOW which is done in date.c.
> The intialization of variable x with the value from GIT_TEST_DATE_NOW
> is unneeded since x is initalized by skip_prefix().

It took me a minute to understand what this second sentence meant. I'd
have actually expected "x" to go away, looking at the diff context.

Maybe a more clear explanation would be: We can't get rid of the "x"
variable, since it serves as a generic scratch variable for parsing
later in the function.

(I'd also probably have just rolled this into patch 1, but I'm OK with
it either way).

-Peff
Junio C Hamano Sept. 9, 2019, 7:44 p.m. UTC | #2
Jeff King <peff@peff.net> writes:

> On Sun, Sep 08, 2019 at 06:47:11PM -0700, Stephen P. Smith wrote:
>
>> Remove the reference to the GIT_TEST_DATE_NOW which is done in date.c.
>> The intialization of variable x with the value from GIT_TEST_DATE_NOW
>> is unneeded since x is initalized by skip_prefix().
>
> It took me a minute to understand what this second sentence meant. I'd
> have actually expected "x" to go away, looking at the diff context.
>
> Maybe a more clear explanation would be: We can't get rid of the "x"
> variable, since it serves as a generic scratch variable for parsing
> later in the function.
>
> (I'd also probably have just rolled this into patch 1, but I'm OK with
> it either way).

Thanks for saying everything ;-)  I have nothing to add.

Patch
diff mbox series

diff --git a/t/helper/test-date.c b/t/helper/test-date.c
index deb5869343..099eff4f0f 100644
--- a/t/helper/test-date.c
+++ b/t/helper/test-date.c
@@ -104,7 +104,6 @@  static void getnanos(const char **argv)
 int cmd__date(int argc, const char **argv)
 {
 	const char *x;
-	x = getenv("GIT_TEST_DATE_NOW");
 
 	argv++;
 	if (!*argv)