From: Ævar Arnfjörð Bjarmason Date: Mon, 28 Nov 2022 14:18:55 GMT Subject: [PATCH v2] t5314: check exit code of "git" Message-ID: In-Reply-To: Amend the test added in [1] to check the exit code of the "git" invocations. An in-flight change[2] introduced a memory leak in these invocations, which went undetected unless we were running under "GIT_TEST_SANITIZE_LEAK_LOG=true". Note that the in-flight change made 8 test files fail, but as far as I can tell only this one would have had its exit code hidden unless under "GIT_TEST_SANITIZE_LEAK_LOG=true". The rest would be caught without it. We could pick other variable names here than "ln%d", e.g. "commit", "dummy_blob" and "file_blob", but having the "rev-parse" invocations aligned makes the difference between them more readable, so let's pick "ln%d". 1. 4cf2143e029 (pack-objects: break delta cycles before delta-search phase, 2016-08-11) 2. https://lore.kernel.org/git/221128.868rjvmi3l.gmgdl@evledraar.gmail.com/ 3. faececa53f9 (test-lib: have the "check" mode for SANITIZE=leak consider leak logs, 2022-07-28) Signed-off-by: Ævar Arnfjörð Bjarmason --- Range-diff against v1: 1: 45b240740eb ! 1: ca77a7249e6 t5314: check exit code of "rev-parse" @@ Metadata Author: Ævar Arnfjörð Bjarmason ## Commit message ## - t5314: check exit code of "rev-parse" + t5314: check exit code of "git" - Amend the test added in [1] to check the exit code of the "rev-parse" + Amend the test added in [1] to check the exit code of the "git" invocations. An in-flight change[2] introduced a memory leak in these invocations, which went undetected unless we were running under "GIT_TEST_SANITIZE_LEAK_LOG=true". @@ Commit message under "GIT_TEST_SANITIZE_LEAK_LOG=true". The rest would be caught without it. + We could pick other variable names here than "ln%d", e.g. "commit", + "dummy_blob" and "file_blob", but having the "rev-parse" invocations + aligned makes the difference between them more readable, so let's pick + "ln%d". + 1. 4cf2143e029 (pack-objects: break delta cycles before delta-search phase, 2016-08-11) 2. https://lore.kernel.org/git/221128.868rjvmi3l.gmgdl@evledraar.gmail.com/ @@ t/t5314-pack-cycle-detection.sh: TEST_PASSES_SANITIZE_LEAK=true - } | - git pack-objects --stdout | - git index-pack --stdin --fix-thin -+ grp1=$(git rev-parse "$2") && -+ grp2=$(git rev-parse "$1:dummy") && -+ grp3=$(git rev-parse "$1:file") && ++ ln1=$(git rev-parse "$2") && ++ ln2=$(git rev-parse "$1:dummy") && ++ ln3=$(git rev-parse "$1:file") && + cat >list <<-EOF -+ -$grp1 -+ $grp2 dummy -+ $grp3 file ++ -$ln1 ++ $ln2 dummy ++ $ln3 file + EOF + git pack-objects --stdout pack && + git index-pack --stdin --fix-thin list <<-EOF + -$ln1 + $ln2 dummy + $ln3 file + EOF + git pack-objects --stdout pack && + git index-pack --stdin --fix-thin