git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] contrib/subtree: fix linefeeds trimming for cmd_split()

From
Junio C Hamano <gitster@pobox.com>
Date
May 5, 2015, 19:11 UTC
Message-ID
<xmqq4mnqet5d.fsf@gitster.dls.corp.google.com>
In-Reply-To
<CAMbsUu6xZrMu_jrV=jR4XNLf1UXLApBiAWJiWJuKRb4xN90QJQ@mail.gmail.com>
Danny Lin <danny0838@gmail.com> writes:
Show 14 quoted lines
>> I think this was written knowing that "say" is merely a thin wrapper
>> of "echo" (which is a bad manner but happens to be correct) and
>> assuming that everybody's "echo" understands "-n" (which is not a
>> good assumption) to implement "progress display" that shows the "N
>> out of M done" output over and over on the same physical line.
>>
>> So,... contrary to your "makes no sense" claim, what it tries to do
>> makes perfect sense to me, even though its execution seems somewhat
>> poor.
>>
> The original version has a CR (yes, it's CR, not LF) at the end of the
> "say -n" string, which is weird. If it's meant to print a linefeed, we should
> remove the CR and use "say". If it's meant not to print a linefeed, we still
> should remove the CR.

Neither. It is meant to print a carriage-return, i.e. "go back to the left-most column on the same line, without feeding a new line to the terminal (causing the output to scroll-up by one line)".

It sounds to me that your terminal is not supporting carriage-return in a way everybody else expects it to? It is not just this script, but all the progress output we generate use CR for that purpose.

Do you see a similar "garbled" output from say "git fetch" or "git checkout" that takes more than a few hundred milliseconds?

Previous: Danny LinNext: Danny Lin
Message 2 of 7 in “Re: [PATCH] contrib/subtree: fix linefeeds trimming for cmd_split()”
  1. Danny LinMay 5, 2015
  2. Junio C HamanoMay 5, 2015
  3. Danny LinMay 6, 2015
  4. Junio C HamanoMay 6, 2015
  5. Danny LinMay 6, 2015
  6. Junio C HamanoMay 6, 2015
  7. Eric SunshineMay 6, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.