git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
May 19, 2015, 15:44 UTC
Message-ID
<xmqqa8x0a7wq.fsf@gitster.dls.corp.google.com>
In-Reply-To
<555ADAF7.5020001@diamand.org>
Luke Diamand <luke@diamand.org> writes:
Show 11 quoted lines
> 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-<.
Previous: Luke DiamandNext: Luke Diamand
Message 2 of 11 in “git-p4: test t9820-git-p4-editor-handling.sh failing”
  1. Luke DiamandMay 19, 2015
  2. Junio C HamanoMay 19, 2015
  3. 0/3 git-p4: fix handling of multi-word P4EDITORLuke Diamand, May 19, 2015
  4. 1/3 git-p4: add failing test for P4EDITOR handlingLuke Diamand, May 19, 2015
  5. Junio C HamanoMay 20, 2015
  6. Junio C HamanoMay 20, 2015
  7. Luke DiamandMay 20, 2015
  8. 2/3 git-p4: fix handling of multi-word P4EDITORLuke Diamand, May 19, 2015
  9. 3/3 git-p4: tests: use test-chmtime in place of touchLuke Diamand, May 19, 2015
  10. Luke DiamandMay 19, 2015
  11. Junio C HamanoMay 24, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.