git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Redirecting Checkout Output To Variable And Tee StdErr
@ 2025-06-04  8:00 Nathan Royce
  0 siblings, 0 replies; only message in thread
From: Nathan Royce @ 2025-06-04  8:00 UTC (permalink / raw)
  To: git

Assigning the subshell output for a `clone` to a variable, while
simultaneously outputting to the user works.
With `checkout`, it does not.

This was brought up in IRC #git and #bash, and JAA (most of all) and
jast and others have contributed well to this finding.
This came about by my need to clone part of texlive (which supposedly
would otherwise be 6GB (it was already 700MB @ 8%), when I only needed
the source, so I used the great `--filter=blob:none`. (I have been
made aware of (in the tug ML) the nice `git svn` feature, but wanted
something that'd apply to all git repos I come across.)
With this blobless clone, it'll only be like 8MB.
My intent is to be able to have the user know progress is happening as
git `--progress`es, but also grab the output and act on messages that
may come up (like any error, where I act on a string of the error).

Test:
$ cloneVar=$(git clone --progress --branch trunk --depth 1
--filter=blob:none --no-checkout -- git://git.texlive.info/texlive
2>&1 | tee /dev/stderr)
$ checkoutVar=$(git checkout --progress trunk -- Build/source 2>&1 |
tee /dev/stderr)

`GIT_TRACE=1` was also mentioned, and that certainly provides
output... And while I saw `fetch` being mentioned in it, I saw no
reference to `Build/source` in the output to draw on (in case I could
manually use `fetch` itself to only get a subpath (which isn't even
looking like it's an option)).

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-06-04  8:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-04  8:00 Redirecting Checkout Output To Variable And Tee StdErr Nathan Royce

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).