{"thread":{"id":"63356","subject":"Workflow for bisecting with test in a branch","startedAt":"2025-04-27T08:18:45Z","lastAt":"2025-04-28T07:41:27Z","messageCount":2,"participants":["Victor Engmark","Christian Couder"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"516853","messageId":"02671927-2e65-4bd3-904b-b564849d1fa5@engmark.name","threadId":"63356","inReplyTo":null,"subject":"Workflow for bisecting with test in a branch","fromName":"Victor Engmark","fromEmail":"victor@engmark.name","sentAt":"2025-04-27T08:18:42Z","receivedAt":"2025-04-27T08:18:45Z","isPatch":false,"sender":{"key":"victor@engmark.name","avatar":"https://avatars.githubusercontent.com/u/168301?v=4"},"body":"I'd like to bisect using a test I've written in a different branch from \nthe one I'm bisecting. But to do `git bisect run ./test.bash` I have to \nkeep the new test file and an old test suite file the same during the \nwhole `bisect` process. This turned out pretty cumbersome:\n\ntest.bash:\n\n```\n#!/usr/bin/env bash\n\nset -o errexit\n\ngit show my-test-branch:test-suite-path > test-suite-path\nmkdir -p test-dir\ngit show my-test-branch:test-dir/test-file > test-dir/test-file\n\nrun_test || exit_code=$?\ngit checkout .\nexit \"${exit_code-0}\"\n```\n\nConsole session:\n\n```\ngit bisect start my-test-branch known-good-ancestor\ngit bisect run ./test.bash\n```\n\nIs there a more streamlined way to achieve the same thing, that is, \nforcing some checked-in files to not change while bisecting?\n\nKind regards\nVictor Engmark\n"},{"id":"516881","messageId":"CAP8UFD1fzLjNdrhv8yuGJmjKsJRU0kaa4rtV=ur+3CMYZD2wzA@mail.gmail.com","threadId":"63356","inReplyTo":"02671927-2e65-4bd3-904b-b564849d1fa5@engmark.name","subject":"Re: Workflow for bisecting with test in a branch","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2025-04-28T07:41:13Z","receivedAt":"2025-04-28T07:41:27Z","isPatch":false,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"On Sun, Apr 27, 2025 at 10:18 AM Victor Engmark <victor@engmark.name> wrote:\n>\n> I'd like to bisect using a test I've written in a different branch from\n> the one I'm bisecting. But to do `git bisect run ./test.bash` I have to\n> keep the new test file and an old test suite file the same during the\n> whole `bisect` process. This turned out pretty cumbersome:\n\n[...]\n\n> Is there a more streamlined way to achieve the same thing, that is,\n> forcing some checked-in files to not change while bisecting?\n\nYou could perhaps use worktrees (see\nhttps://git-scm.com/docs/git-worktree) to have a separate worktree\nwith the checked-in files that shouldn't change, while performing the\nbisection and building in the main worktree. If all the needed files\nand directories are properly set up on the separate worktree, you\ncould copy them over using a single `cp -a ...` command.\n\nAlso I think that conceptually it's more the responsibility of your\nbuild and test system, rather than the SCM, to provide you with clean,\nout of source builds and tests.\n\nBest,\nChristian.\n"}]}