{"thread":{"id":"64786","subject":"pre-push hooks and stdout regression","startedAt":"2026-01-12T23:38:07Z","lastAt":"2026-01-13T20:57:03Z","messageCount":5,"participants":["Chris Darroch","brian m. carlson","Adrian Ratiu"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"533689","messageId":"ab578804-891e-edcc-12a6-8b1030d1bacb@apache.org","threadId":"64786","inReplyTo":null,"subject":"pre-push hooks and stdout regression","fromName":"Chris Darroch","fromEmail":"chrisd@apache.org","sentAt":"2026-01-12T23:21:42Z","receivedAt":"2026-01-12T23:38:07Z","isPatch":false,"sender":{"key":"chrisd@apache.org","avatar":null},"body":"Hello --\n\n   I'm one of the current maintainers of the Git LFS project, and we\nhappened to notice that a recent change in Git's \"master\" branch has\nintroduced a regression in our test suite.\n\n   Specifically, with commit 3e2836a742d8b2b2da25ca06e9d0ac3a539bd966\n(\"transport: convert pre-push to hook API\") from the \"ar/run-command-hook\"\nmerged last week, it appears that when a pre-push hook such as our\ngit-lfs-pre-push program runs, messages it writes to its standard output\nare now delivered to the user's standard error stream instead of\ntheir standard output stream.\n\n   I suspect this is because the pick_next_hook() function in hook.c\nsets the stdout_to_stderr flag for its \"cb\" child_process argument,\nand that function is now used to run the pre-push hook.\n\n   Arguably, the Git LFS pre-push hook program should write its\nprogress meter messages to stderr, but since at least 2017 it appears\nwe have used stdout for this purpose:\n\nhttps://github.com/git-lfs/git-lfs/commit/d665f7d725150761fe3b196da2c2d4448f7d2c61\nhttps://github.com/git-lfs/git-lfs/pull/2732\n\n   We can certainly work around this change in the Git LFS test suite,\nsince our progress messages are still output by Git, just to stderr\ninstead of stdout.\n\n   However, I think there remains the larger concern that users who\ndepend on the existing Git pre-push behaviour in some way may also\nencounter regressions, perhaps because they expect (as our test suite\ndoes) to see certain messages either output or not output to stderr\nduring a Git push operation.\n\n   Please do let me know your thoughts on this subject!  If the\nconsensus is that the new behaviour is correct, we'll adjust our test\nsuite to match it, but I'll wait to hear the outcome of any discussion\nbefore making that change.\n\n   Thank you again and all the best,\n\nChris.\n\n-- \nGPG Key ID: 088335A9\nGPG Key Fingerprint: 86CD 3297 7493 75BC F820  6715 F54F E648 0883 35A9\n\n"},{"id":"533693","messageId":"aWWp-FPzKdL72c9v@fruit.crustytoothpaste.net","threadId":"64786","inReplyTo":"ab578804-891e-edcc-12a6-8b1030d1bacb@apache.org","subject":"Re: pre-push hooks and stdout regression","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2026-01-13T02:12:08Z","receivedAt":"2026-01-13T02:12:11Z","isPatch":false,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2026-01-12 at 23:21:42, Chris Darroch wrote:\n> Hello --\n> \n>    I'm one of the current maintainers of the Git LFS project, and we\n> happened to notice that a recent change in Git's \"master\" branch has\n> introduced a regression in our test suite.\n> \n>    Specifically, with commit 3e2836a742d8b2b2da25ca06e9d0ac3a539bd966\n> (\"transport: convert pre-push to hook API\") from the \"ar/run-command-hook\"\n> merged last week, it appears that when a pre-push hook such as our\n> git-lfs-pre-push program runs, messages it writes to its standard output\n> are now delivered to the user's standard error stream instead of\n> their standard output stream.\n\nCCing the author and submitter.\n\n>    I suspect this is because the pick_next_hook() function in hook.c\n> sets the stdout_to_stderr flag for its \"cb\" child_process argument,\n> and that function is now used to run the pre-push hook.\n\nThat's likely the case.  96e7225b31 (\"hook: add 'run' subcommand\",\n2021-12-22), which introduced that code, didn't provide an explanation\nfor that decision.  I think that's required for hooks such as\npre-receive that send data over the sideband, and it may be that the\ncode was simply reused.  Of course, I could be mistaken.\n\n>    However, I think there remains the larger concern that users who\n> depend on the existing Git pre-push behaviour in some way may also\n> encounter regressions, perhaps because they expect (as our test suite\n> does) to see certain messages either output or not output to stderr\n> during a Git push operation.\n\nI suspect that we're also going to see similar regressions in other\nsoftware.  pre-push hooks are really popular, as well as pre-commit\nhooks, and people are going to expect both standard output and standard\nerror to be connected to the same place they were before.\n\nA quick check of pre-push hook frameworks on GitHub indicates that a\nsubstantial number of them print to standard output, even for error\nmessages.  I expect that we will actually see quite a bit of breakage in\nthis case, especially from automated tooling and Git graphical\nfrontends, which may expect data in a certain place.  I don't have any\nproof of this, however, but it does seem like the kind of thing that\npeople will have come to rely on.\n\nI'd recommend that we avoid using `stdout_to_stderr` for hooks unless we\ndid originally or really need to (e.g., for things that might go over\nthe sideband).\n\n>    Please do let me know your thoughts on this subject!  If the\n> consensus is that the new behaviour is correct, we'll adjust our test\n> suite to match it, but I'll wait to hear the outcome of any discussion\n> before making that change.\n\nI will just state for the benefit of the list that Chris and I are\ncolleagues and we discussed this at work, so I asked him to CC me on\nthis issue since I was curious.  My opinions here, as with everything\noriginating from this email address, are mine and not my employer's.\n-- \nbrian m. carlson (they/them)\nToronto, Ontario, CA\n"},{"id":"533715","messageId":"87y0m1onad.fsf@gentoo.mail-host-address-is-not-set","threadId":"64786","inReplyTo":"ab578804-891e-edcc-12a6-8b1030d1bacb@apache.org","subject":"Re: pre-push hooks and stdout regression","fromName":"Adrian Ratiu","fromEmail":"adrian.ratiu@collabora.com","sentAt":"2026-01-13T09:49:14Z","receivedAt":"2026-01-13T09:49:36Z","isPatch":false,"sender":{"key":"adrian.ratiu@collabora.com","avatar":"https://avatars.githubusercontent.com/u/12472556?v=4"},"body":"On Mon, 12 Jan 2026, Chris Darroch <chrisd@apache.org> wrote:\n> Hello --\n>\n>    I'm one of the current maintainers of the Git LFS project, and we\n> happened to notice that a recent change in Git's \"master\" branch has\n> introduced a regression in our test suite.\n>\n>    Specifically, with commit 3e2836a742d8b2b2da25ca06e9d0ac3a539bd966\n> (\"transport: convert pre-push to hook API\") from the \"ar/run-command-hook\"\n> merged last week, it appears that when a pre-push hook such as our\n> git-lfs-pre-push program runs, messages it writes to its standard output\n> are now delivered to the user's standard error stream instead of\n> their standard output stream.\n>\n>    I suspect this is because the pick_next_hook() function in hook.c\n> sets the stdout_to_stderr flag for its \"cb\" child_process argument,\n> and that function is now used to run the pre-push hook.\n>\n>    Arguably, the Git LFS pre-push hook program should write its\n> progress meter messages to stderr, but since at least 2017 it appears\n> we have used stdout for this purpose:\n>\n> https://github.com/git-lfs/git-lfs/commit/d665f7d725150761fe3b196da2c2d4448f7d2c61\n> https://github.com/git-lfs/git-lfs/pull/2732\n>\n>    We can certainly work around this change in the Git LFS test suite,\n> since our progress messages are still output by Git, just to stderr\n> instead of stdout.\n>\n>    However, I think there remains the larger concern that users who\n> depend on the existing Git pre-push behaviour in some way may also\n> encounter regressions, perhaps because they expect (as our test suite\n> does) to see certain messages either output or not output to stderr\n> during a Git push operation.\n>\n>    Please do let me know your thoughts on this subject!  If the\n> consensus is that the new behaviour is correct, we'll adjust our test\n> suite to match it, but I'll wait to hear the outcome of any discussion\n> before making that change.\n>\n>    Thank you again and all the best,\n\nThank you for reporting this, it's exactly the kind of regressions I'm\nlooking for and the reason I did the \"Extending git without breaking it\"\npresentation during the mini-summit a few months ago (video should be\nonline).\n\nI tend to agree with Brian that going back to the previous behavior is\nbest for now, maybe schedule a breaking change or extension to make\nhooks to print to stderr instead of stdout.\n\nI will test this on my parallel config based hooks topic towards which\nthis conversion is building up to and send a patch or report back ASAP.\n\nOf course I will also run the git LFS test suite to confirm the\nregression and the fix.\n"},{"id":"533736","messageId":"87pl7diti0.fsf@gentoo.mail-host-address-is-not-set","threadId":"64786","inReplyTo":"87y0m1onad.fsf@gentoo.mail-host-address-is-not-set","subject":"Re: pre-push hooks and stdout regression","fromName":"Adrian Ratiu","fromEmail":"adrian.ratiu@collabora.com","sentAt":"2026-01-13T12:31:35Z","receivedAt":"2026-01-13T12:31:50Z","isPatch":false,"sender":{"key":"adrian.ratiu@collabora.com","avatar":"https://avatars.githubusercontent.com/u/12472556?v=4"},"body":"On Tue, 13 Jan 2026, Adrian Ratiu <adrian.ratiu@collabora.com> wrote:\n> On Mon, 12 Jan 2026, Chris Darroch <chrisd@apache.org> wrote:\n>> Hello --\n>>\n>>    I'm one of the current maintainers of the Git LFS project, and we\n>> happened to notice that a recent change in Git's \"master\" branch has\n>> introduced a regression in our test suite.\n>>\n>>    Specifically, with commit 3e2836a742d8b2b2da25ca06e9d0ac3a539bd966\n>> (\"transport: convert pre-push to hook API\") from the \"ar/run-command-hook\"\n>> merged last week, it appears that when a pre-push hook such as our\n>> git-lfs-pre-push program runs, messages it writes to its standard output\n>> are now delivered to the user's standard error stream instead of\n>> their standard output stream.\n>>\n>>    I suspect this is because the pick_next_hook() function in hook.c\n>> sets the stdout_to_stderr flag for its \"cb\" child_process argument,\n>> and that function is now used to run the pre-push hook.\n>>\n>>    Arguably, the Git LFS pre-push hook program should write its\n>> progress meter messages to stderr, but since at least 2017 it appears\n>> we have used stdout for this purpose:\n>>\n>> https://github.com/git-lfs/git-lfs/commit/d665f7d725150761fe3b196da2c2d4448f7d2c61\n>> https://github.com/git-lfs/git-lfs/pull/2732\n>>\n>>    We can certainly work around this change in the Git LFS test suite,\n>> since our progress messages are still output by Git, just to stderr\n>> instead of stdout.\n>>\n>>    However, I think there remains the larger concern that users who\n>> depend on the existing Git pre-push behaviour in some way may also\n>> encounter regressions, perhaps because they expect (as our test suite\n>> does) to see certain messages either output or not output to stderr\n>> during a Git push operation.\n>>\n>>    Please do let me know your thoughts on this subject!  If the\n>> consensus is that the new behaviour is correct, we'll adjust our test\n>> suite to match it, but I'll wait to hear the outcome of any discussion\n>> before making that change.\n>>\n>>    Thank you again and all the best,\n>\n> Thank you for reporting this, it's exactly the kind of regressions I'm\n> looking for and the reason I did the \"Extending git without breaking it\"\n> presentation during the mini-summit a few months ago (video should be\n> online).\n>\n> I tend to agree with Brian that going back to the previous behavior is\n> best for now, maybe schedule a breaking change or extension to make\n> hooks to print to stderr instead of stdout.\n>\n> I will test this on my parallel config based hooks topic towards which\n> this conversion is building up to and send a patch or report back ASAP.\n>\n> Of course I will also run the git LFS test suite to confirm the\n> regression and the fix.\n\nI couldn't reproduce the git-lfs test failure using the public tests\nfrom the git-lfs repo (they always pass), however this patch should fix\nit:\n\nhttps://lore.kernel.org/git/20260113115633.230479-1-adrian.ratiu@collabora.com/T/#u\n\nChris or Brian, can you please confirm if it works? Much appreciated.\n"},{"id":"533773","messageId":"86fa98ad-973c-ea5d-e0c7-fe092747a874@apache.org","threadId":"64786","inReplyTo":"87pl7diti0.fsf@gentoo.mail-host-address-is-not-set","subject":"Re: pre-push hooks and stdout regression","fromName":"Chris Darroch","fromEmail":"chrisd@apache.org","sentAt":"2026-01-13T20:44:51Z","receivedAt":"2026-01-13T20:57:03Z","isPatch":false,"sender":{"key":"chrisd@apache.org","avatar":null},"body":"Adrian:\n\n> On Tue, 13 Jan 2026, Adrian Ratiu <adrian.ratiu@collabora.com> wrote:\n>> On Mon, 12 Jan 2026, Chris Darroch <chrisd@apache.org> wrote:\n>>> Hello --\n>>>\n>>>    I'm one of the current maintainers of the Git LFS project, and we\n>>> happened to notice that a recent change in Git's \"master\" branch has\n>>> introduced a regression in our test suite.\n>>>\n>>>    Specifically, with commit 3e2836a742d8b2b2da25ca06e9d0ac3a539bd966\n>>> (\"transport: convert pre-push to hook API\") from the \"ar/run-command-hook\"\n>>> merged last week, it appears that when a pre-push hook such as our\n>>> git-lfs-pre-push program runs, messages it writes to its standard output\n>>> are now delivered to the user's standard error stream instead of\n>>> their standard output stream.\n>>>\n>>>    I suspect this is because the pick_next_hook() function in hook.c\n>>> sets the stdout_to_stderr flag for its \"cb\" child_process argument,\n>>> and that function is now used to run the pre-push hook.\n>>>\n>>>    Arguably, the Git LFS pre-push hook program should write its\n>>> progress meter messages to stderr, but since at least 2017 it appears\n>>> we have used stdout for this purpose:\n>>>\n>>> https://github.com/git-lfs/git-lfs/commit/d665f7d725150761fe3b196da2c2d4448f7d2c61\n>>> https://github.com/git-lfs/git-lfs/pull/2732\n>>>\n>>>    We can certainly work around this change in the Git LFS test suite,\n>>> since our progress messages are still output by Git, just to stderr\n>>> instead of stdout.\n>>>\n>>>    However, I think there remains the larger concern that users who\n>>> depend on the existing Git pre-push behaviour in some way may also\n>>> encounter regressions, perhaps because they expect (as our test suite\n>>> does) to see certain messages either output or not output to stderr\n>>> during a Git push operation.\n>>>\n>>>    Please do let me know your thoughts on this subject!  If the\n>>> consensus is that the new behaviour is correct, we'll adjust our test\n>>> suite to match it, but I'll wait to hear the outcome of any discussion\n>>> before making that change.\n>>>\n>>>    Thank you again and all the best,\n>>\n>> Thank you for reporting this, it's exactly the kind of regressions I'm\n>> looking for and the reason I did the \"Extending git without breaking it\"\n>> presentation during the mini-summit a few months ago (video should be\n>> online).\n>>\n>> I tend to agree with Brian that going back to the previous behavior is\n>> best for now, maybe schedule a breaking change or extension to make\n>> hooks to print to stderr instead of stdout.\n>>\n>> I will test this on my parallel config based hooks topic towards which\n>> this conversion is building up to and send a patch or report back ASAP.\n>>\n>> Of course I will also run the git LFS test suite to confirm the\n>> regression and the fix.\n> \n> I couldn't reproduce the git-lfs test failure using the public tests\n> from the git-lfs repo (they always pass), however this patch should fix\n> it:\n> \n> https://lore.kernel.org/git/20260113115633.230479-1-adrian.ratiu@collabora.com/T/#u\n> \n> Chris or Brian, can you please confirm if it works? Much appreciated.\n\n   Thanks very much for taking a look at this!  I can confirm this\ninitial patch works to resolve our Git LFS test suite failures.  I'll\nkeep an eye on the subsequent patch proposals and try to test them as\nthey are developed.\n\n   For reference, the Git LFS test suite failures occurred in places where\nour shell tests happened to only capture messages from \"git push\" commands\non stdout, instead of capturing both stdout and stderr.  For example,\nthe \"fetch: setup for include test\" test in our t/t-fetch-include.sh\nscript was failing at this grep(1) command:\n\nhttps://github.com/git-lfs/git-lfs/blob/1f2f7c697b5568b4bf1ed76e7ed4115dd1f0b3ba/t/t-fetch-include.sh#L39\n\n   One can run these shell tests by entering the \"t\" directory, e.g.:\n\n$ cd t\n$ make t-fetch-include.sh\n\n   (Confusingly, the Git LFS project also has a bunch of Go language\ntests which \"make test\" runs if you're in the top-level directory,\nwhile \"make test\" in the \"t\" directory runs the shell test suite instead.)\n\n   Thanks again for taking time to help resolve this issue!\nAll the best,\n\nChris.\n\n-- \nGPG Key ID: 088335A9\nGPG Key Fingerprint: 86CD 3297 7493 75BC F820  6715 F54F E648 0883 35A9\n\n"}]}