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

Re: [PATCH] t/: work around one-shot variable assignment with test_must_fail

From
Erick Mattos <erick.mattos@gmail.com>
Date
Jul 22, 2010, 00:28 UTC
Message-ID
<AANLkTikUs2kSqeNxzCW0fag4K_4yuQSX1JKwk4pFd0Ni@mail.gmail.com>
In-Reply-To
<QGT_6Gjw_prM4Z_TThjuP3s9CSH7c4P6hnnNpVLNYxcJL6N_1HxuGQ@cipher.nrlssc.navy.mil>
Hi,
2010/7/21 Brandon Casey <casey@nrlssc.navy.mil>:
Show 8 quoted lines
> On 07/20/2010 06:19 PM, Erick Mattos wrote:
>> 2010/7/20 Brandon Casey <casey@nrlssc.navy.mil>
>>> No time to investigate, but here is an example patch and the
>>> results of running the affected tests.
>
>> You have made cosmetic changes which do not do the same as the original.
>?
> Nope, look closer.  The changes are not cosmetic.

Now I see it. I was not completely aware of the problem, only of your email. Maybe I should subscribe to the list at last... ;-D

Show 7 quoted lines
> Try this:
>
>   run_it () { "$@"; }; run_it foo= true && echo success || echo failure
>
> You probably get something like this (if you're using bash):
>
>   bash: foo=: command not found
It would work if it was like:
run_it () { eval "$@"; }; run_it "foo= true" && echo success || echo failure
But I think your approach is better shaped for a fast solution.
Show 15 quoted lines
> That's because the one-shot variable assignment doesn't work when
> used like this.  It also means that the original tests which do:
>
>   test_must_fail PAGER= git ...
>
> are broken.  We ran into this problem a while back and fixed it in
> the commit that I referenced (e2007832).  I fixed the new instances
> in t2017, t3200, and t3301 in the patch that I sent.
>
> For the tests in t2017 and t3200 that now fail, the originals seem to
> expect 'git reflog show' to return non-zero when asked to show the reflog
> for a ref which doesn't have a log.  reflog does not currently return
> non-zero in this case.  Either the tests should be updated to reflect
> the actual behavior of 'reflog show', or 'reflog show' should be updated
> to return non-zero when passed a ref without a log.
So fixing it is a need.

On t2017 and t3200 the problem that appeared was because no message and error had been generated when there is no reflog. Git reflog when run on a ref with a nonexistent reflog file exits with 0 saying nothing.

I don't see this as a correct behavior but as those tests were just to enforce the previous "! test -f..." test which is already enough for checking the intended behavior then I would think it was good enough just to wipe out the "problematic git reflog" commands until deciding how quiet git reflog command should be when there is no reflog file to show.

Although I just realized Junio sent an email following this thread and I bet he could give a better solution or his directions. Going to read it now.

Thanks for your clarifications.
Regards
Previous: Brandon CaseyNext: Ævar Arnfjörð Bjarmason
Message 23 of 40 in “t/t3700: convert two uses of negation operator '!' to use test_must_fail”
  1. t/t3700: convert two uses of negation operator '!' to use test_must_failBrandon Casey, Jul 20, 2010
  2. Ævar Arnfjörð BjarmasonJul 20, 2010
  3. Brandon CaseyJul 20, 2010
  4. Jared HanceJul 20, 2010
  5. t/README: clarify test_must_fail descriptionBrandon Casey, Jul 20, 2010
  6. Junio C HamanoJul 20, 2010
  7. Ævar Arnfjörð BjarmasonJul 20, 2010
  8. Jared HanceJul 20, 2010
  9. Convert "! git" to "test_must_fail" git.Jared Hance, Jul 20, 2010
  10. Brandon CaseyJul 20, 2010
  11. Jonathan NiederJul 20, 2010
  12. Brandon CaseyJul 20, 2010
  13. Convert "! git" to "test_must_fail git"Jared Hance, Jul 20, 2010
  14. Junio C HamanoJul 20, 2010
  15. Ævar Arnfjörð BjarmasonJul 20, 2010
  16. Jonathan NiederJul 20, 2010
  17. Ævar Arnfjörð BjarmasonJul 20, 2010
  18. Brandon CaseyJul 20, 2010
  19. Ævar Arnfjörð BjarmasonJul 20, 2010
  20. t/: work around one-shot variable assignment with test_must_failBrandon Casey, Jul 20, 2010
  21. Erick MattosJul 20, 2010
  22. Brandon CaseyJul 21, 2010
  23. Erick MattosJul 22, 2010
  24. Ævar Arnfjörð BjarmasonJul 20, 2010
  25. Ævar Arnfjörð BjarmasonJul 20, 2010
  26. Jonathan NiederJul 21, 2010
  27. Ævar Arnfjörð BjarmasonJul 21, 2010
  28. Jonathan NiederJul 21, 2010
  29. Ævar Arnfjörð BjarmasonJul 21, 2010
  30. git name-rev for fun and profit (Re: [PATCH] t/: work around one-shot variable assignment with test_must_fail)Jonathan Nieder, Jul 21, 2010
  31. Ævar Arnfjörð BjarmasonJul 21, 2010
  32. Junio C HamanoJul 21, 2010
  33. Erick MattosJul 22, 2010
  34. Brandon CaseyJul 22, 2010
  35. Brandon CaseyJul 20, 2010
  36. Ævar Arnfjörð BjarmasonJul 20, 2010
  37. Ævar Arnfjörð BjarmasonJul 20, 2010
  38. gitweb: clarify search results page when no matching commit foundJonathan Nieder, Jul 21, 2010
  39. Jakub NarebskiJul 21, 2010
  40. gitweb: clarify search results page when no matching commit foundJonathan Nieder, Jul 21, 2010

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.