Subject: Re: git-p4: test t9820-git-p4-editor-handling.sh failing

From: Junio C Hamano <[email-masked]>
Date: Tue, 19 May 2015 08:44:53 -0700

Luke Diamand <[email-masked]> writes:

> The test I put in recently for multi-word editor handling in git-p4,
> t9820-git-p4-editor-handling.sh, has started failing.
>
> It looks like the reason is the change to it that goes:
>
> -	P4EDITOR="touch \"$git/touched\"" git p4 submit &&
> +	P4EDITOR=": >\"$git/touched\"" git p4 submit &&
>
> The problem is that git-p4 invokes $P4EDITOR passing it the name of
> the submit template. After it returns, it checks that the editor has
> actually updated the file's modification time.

Sorry, that was an unwarranted and unnecessary amend.  Didn't
realize that touch was trying to affect two files.

But "touch" is not quite right, either.

Unlike human sitting in front of keyboard, our fake editor types
very fast and wallclock time may not change between the time when
"git p4" prepares the file to be edited and the fake editor returns.

Is it really *only* the modification time that is checked?  If our
fake editor adds one blank line and return very fast without
changing the modification time, doesn't the caller notice that (and
if not, shouldn't it be fixed to do so [*1*])?

If you absolutely need to change the timestamp to work around the
caller if it only checks the timestamp and does not notice the size
or contents are different, then test-chmtime would be the right
thing to use in the test suite to do this portably, something like.

    P4EDITOR=": >\"$git/touched\" && test-chmtime +5"

perhaps.

Thanks.

[Footnote]

*1* Yeah, I just checked.  It does check only mtime and wants the
    editor to spend at least one second to edit, which is silly X-<.