Message ID | a2d30eff217e560873c49fe45116c784dc12fd32.1710192973.git.dirk@gouders.net (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Fixes for Documentation/MyFirstObjectWalk.txt | expand |
Dirk Gouders <dirk@gouders.net> writes: > In the last chapter of this document, pipes are used in commands to > filter out the first/last trace messages. But according to git(1), > trace messages are sent to stderr if GIT_TRACE is set to '1', so those > commands do not produce the described results. > > Fix this by using the operator '|&' to additionally connect stderr to > stdin of the latter command. Isn't |& a bash-ism? upstream command >&2 | downstream command is how you would do the same more portably.
Junio C Hamano <gitster@pobox.com> writes: > Dirk Gouders <dirk@gouders.net> writes: > >> In the last chapter of this document, pipes are used in commands to >> filter out the first/last trace messages. But according to git(1), >> trace messages are sent to stderr if GIT_TRACE is set to '1', so those >> commands do not produce the described results. >> >> Fix this by using the operator '|&' to additionally connect stderr to >> stdin of the latter command. > > Isn't |& a bash-ism? > > upstream command >&2 | downstream command > > is how you would do the same more portably. Ah yes, it is a bash-ism, thank you. I guess you meant upstream command 2>&1 | downstream command I will wait a bit (some days) for other comments and then at least remove this bash-ism plus the wrong tags you also mentioned -- also thanks for that. Dirk
Dirk Gouders <dirk@gouders.net> writes: > Ah yes, it is a bash-ism, thank you. > > I guess you meant Yup, thanks, that was a typo. > upstream command 2>&1 | downstream command
diff --git a/Documentation/MyFirstObjectWalk.txt b/Documentation/MyFirstObjectWalk.txt index 981dbf917b..b96724c4d7 100644 --- a/Documentation/MyFirstObjectWalk.txt +++ b/Documentation/MyFirstObjectWalk.txt @@ -847,7 +847,7 @@ those lines without having to recompile. With only that change, run again (but save yourself some scrollback): ---- -$ GIT_TRACE=1 ./bin-wrappers/git walken | head -n 10 +$ GIT_TRACE=1 ./bin-wrappers/git walken |& head -n 10 ---- Take a look at the top commit with `git show` and the object ID you printed; it @@ -875,7 +875,7 @@ of the first handful: ---- $ make -$ GIT_TRACE=1 ./bin-wrappers git walken | tail -n 10 +$ GIT_TRACE=1 ./bin-wrappers git walken |& tail -n 10 ---- The last commit object given should have the same OID as the one we saw at the
In the last chapter of this document, pipes are used in commands to filter out the first/last trace messages. But according to git(1), trace messages are sent to stderr if GIT_TRACE is set to '1', so those commands do not produce the described results. Fix this by using the operator '|&' to additionally connect stderr to stdin of the latter command. Signed-off-by: Dirk Gouders <dirk@gouders.net> --- Documentation/MyFirstObjectWalk.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)