{"thread":{"id":"53538","subject":"Submodule init uses STDERR output","startedAt":"2020-05-23T22:45:13Z","lastAt":"2020-05-23T23:23:33Z","messageCount":2,"participants":["Michal Vrana","brian m. carlson"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"398461","messageId":"CA+sZKRqMaSZqj3PdpRz3xrruTbz1CJV=W9s_ox4BrhCAuQqhKA@mail.gmail.com","threadId":"53538","inReplyTo":null,"subject":"Submodule init uses STDERR output","fromName":"Michal Vrana","fromEmail":"mivra1@gmail.com","sentAt":"2020-05-23T22:44:59Z","receivedAt":"2020-05-23T22:45:13Z","isPatch":false,"sender":{"key":"mivra1@gmail.com","avatar":null},"body":"Hello,\nI've come across an issue that seems like a bug to me. If I clone a\nrepository with a submodule but want to initialize it separately, then\nthe error output is used during this initialization for what seems to\nbe a standard message.\nMotivation:\nCannot use - Fail on standard error setting in a devops pipeline\n\nSteps to reproduce:\n1. git clone\n2. git submodule init 2>err.txt\n\nThe err.txt contains a message like\nSubmodule 'xyz' (xyz.git) registered for path 'abc'\nFrom what I've read this is the standard output in this case. And if\nnot then why when I use \"quiet\" mode then the error output is empty.\nSo why is the error output even used?\n\nPlatforms reproduced on:\ngit version 2.26.2.windows.1 - Windows server\ngit version 2.19.0.windows.1 - gitbash - Windows 10\ngit version 2.17.1 Ubuntu (Windows subsystem)\n\nThanks,\nMichal Vrana\n"},{"id":"398464","messageId":"20200523232324.GB1915090@camp.crustytoothpaste.net","threadId":"53538","inReplyTo":"CA+sZKRqMaSZqj3PdpRz3xrruTbz1CJV=W9s_ox4BrhCAuQqhKA@mail.gmail.com","subject":"Re: Submodule init uses STDERR output","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-05-23T23:23:24Z","receivedAt":"2020-05-23T23:23:33Z","isPatch":false,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2020-05-23 at 22:44:59, Michal Vrana wrote:\n> Hello,\n> I've come across an issue that seems like a bug to me. If I clone a\n> repository with a submodule but want to initialize it separately, then\n> the error output is used during this initialization for what seems to\n> be a standard message.\n> Motivation:\n> Cannot use - Fail on standard error setting in a devops pipeline\n\nIn general, this is not a good setting to use with Git.  Git uses\nstandard error for many progress outputs if standard output is\npotentially scriptable.  You're better off checking exit codes to\ndetermine success or failure.\n\nGit is also not the only tool to do this; other tools such as Docker do\nas well.\n\n> Steps to reproduce:\n> 1. git clone\n> 2. git submodule init 2>err.txt\n> \n> The err.txt contains a message like\n> Submodule 'xyz' (xyz.git) registered for path 'abc'\n> From what I've read this is the standard output in this case. And if\n> not then why when I use \"quiet\" mode then the error output is empty.\n> So why is the error output even used?\n\nc66410ed32a gives us the answer:\n\n  Reroute the output of stdout to stderr as it is just informative\n  messages, not to be consumed by machines.\n\n  This should not regress any scripts that try to parse the\n  current output, as the output is already internationalized\n  and therefore unstable.\n\n  We want to init submodules from the helper for `submodule update`\n  in a later patch and the stdout output of said helper is consumed\n  by the parts of `submodule update` which are still written in shell.\n  So we have to be careful which messages are on stdout.\n\nI haven't looked to see if we could change it back, but that's the\nreason it was written that way.\n-- \nbrian m. carlson: Houston, Texas, US\nOpenPGP: https://keybase.io/bk2204\n"}]}