{"thread":{"id":"63581","subject":"Redirecting Checkout Output To Variable And Tee StdErr","startedAt":"2025-06-04T08:01:14Z","lastAt":"2025-06-04T08:01:14Z","messageCount":1,"participants":["Nathan Royce"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"519643","messageId":"CALaQ_hoWoovjJHMYz_0f1cE1sqt6upqpivv0qNXLy25vEUuonw@mail.gmail.com","threadId":"63581","inReplyTo":null,"subject":"Redirecting Checkout Output To Variable And Tee StdErr","fromName":"Nathan Royce","fromEmail":"nroycea+kernel@gmail.com","sentAt":"2025-06-04T08:00:37Z","receivedAt":"2025-06-04T08:01:14Z","isPatch":false,"sender":{"key":"nroycea+kernel@gmail.com","avatar":null},"body":"Assigning the subshell output for a `clone` to a variable, while\nsimultaneously outputting to the user works.\nWith `checkout`, it does not.\n\nThis was brought up in IRC #git and #bash, and JAA (most of all) and\njast and others have contributed well to this finding.\nThis came about by my need to clone part of texlive (which supposedly\nwould otherwise be 6GB (it was already 700MB @ 8%), when I only needed\nthe source, so I used the great `--filter=blob:none`. (I have been\nmade aware of (in the tug ML) the nice `git svn` feature, but wanted\nsomething that'd apply to all git repos I come across.)\nWith this blobless clone, it'll only be like 8MB.\nMy intent is to be able to have the user know progress is happening as\ngit `--progress`es, but also grab the output and act on messages that\nmay come up (like any error, where I act on a string of the error).\n\nTest:\n$ cloneVar=$(git clone --progress --branch trunk --depth 1\n--filter=blob:none --no-checkout -- git://git.texlive.info/texlive\n2>&1 | tee /dev/stderr)\n$ checkoutVar=$(git checkout --progress trunk -- Build/source 2>&1 |\ntee /dev/stderr)\n\n`GIT_TRACE=1` was also mentioned, and that certainly provides\noutput... And while I saw `fetch` being mentioned in it, I saw no\nreference to `Build/source` in the output to draw on (in case I could\nmanually use `fetch` itself to only get a subpath (which isn't even\nlooking like it's an option)).\n"}]}