{"thread":{"id":"61504","subject":"Three t4150 tests does not work as expected","startedAt":"2024-05-17T16:46:02Z","lastAt":"2024-05-17T17:55:36Z","messageCount":2,"participants":["Marcel Telka","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"494983","messageId":"ZkeJx97qdLoaC2H-@telcontar","threadId":"61504","inReplyTo":null,"subject":"Three t4150 tests does not work as expected","fromName":"Marcel Telka","fromEmail":"marcel@telka.sk","sentAt":"2024-05-17T16:45:59Z","receivedAt":"2024-05-17T16:46:02Z","isPatch":false,"sender":{"key":"marcel@telka.sk","avatar":"https://avatars.githubusercontent.com/u/3000173?v=4"},"body":"Hi,\n\nI noticed that the following three t4150 tests probably does not work as\nexpected:\n\n- record as an empty commit when meeting e-mail message that lacks a patch\n- record an empty patch as an empty commit in the middle of an am session\n- create an non-empty commit when the index IS changed though \"--allow-empty\" is given\n\nAll of them does something like:\n\n\tgit show HEAD --format=\"%B\" >actual\n\tgrep -f actual expected\n\nWhile the 'actual' file usually contains something like (four lines\nbetween the 'cut' markers):\n\n-------------------------- cut --------------------------\nempty commit\n\n--\n2.45.1\n\n-------------------------- cut --------------------------\n\nIOW, there are two empty lines there.  Because of that the grep gets an\nempty RE from the 'actual' file and so it matches everything that comes\nin the 'expected' file.\n\nIs this the expected behavior?\n\n\nThank you.\n\n-- \n+-------------------------------------------+\n| Marcel Telka   e-mail:   marcel@telka.sk  |\n|                homepage: http://telka.sk/ |\n+-------------------------------------------+\n"},{"id":"494993","messageId":"xmqqcypkiaqy.fsf@gitster.g","threadId":"61504","inReplyTo":"ZkeJx97qdLoaC2H-@telcontar","subject":"Re: Three t4150 tests does not work as expected","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-05-17T17:55:33Z","receivedAt":"2024-05-17T17:55:36Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Marcel Telka <marcel@telka.sk> writes:\n\n> All of them does something like:\n>\n> \tgit show HEAD --format=\"%B\" >actual\n> \tgrep -f actual expected\n\nWow, these commands look nonsensical in as many counts as there are\nlines in there X-< [*].\n\nIt seems that they came from two patches, namely\n\n 7c096b8d (am: support --empty=<option> to handle empty patches, 2021-12-09)\n 9e7e41bf (am: support --allow-empty to record specific empty patches, 2021-12-09)\n\nMost likely the author of these lines were confused and meant to use\ntest_cmp (which by the way should always compare actual against\nexpect, i.e. \"test_cmp expect actual\", because when the actual\noutput differs, that is the order of the diff we want to see in the\noutput to diagnose the breakage).  I especially suspect that the\nauthor did not mean \"read patterns from this file\", but was confused\nto think that 'f' implies \"match literally\" somehow (the correct\nspelling of that fixed-strings option is -F but still it does the\nwrong thing reading from the file---it does not even ensure that\nall patterns listed in the file matches).\n\nI am not saying (as I did not check) that doing just \"grep -f A B\"\n-> \"test_cmp B A\" woudl make things work.  I do not think I trust\nthat these tests added by the same patch have a sane expectations\nX-<.  The outcome these tests try to verify may also need to be\ncorrected.\n\n\n[Footnote] \n\n * To start with, any dashed option like --format=%B should come\n   before a revision argument HEAD.  There are many other\n   antipatterns in this test script, which should be cleaned up.\n"}]}