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

Re: entry terminator/separator behavior in show_log()

From
Adam Simpkins <adam@adamsimpkins.net>
Date
Apr 29, 2008, 08:58 UTC
Message-ID
<20080429085839.GA19705@adamsimpkins.net>
In-Reply-To
<7vtzhmc63w.fsf@gitster.siamese.dyndns.org>
On Mon, Apr 28, 2008 at 09:10:59AM -0700, Junio C Hamano wrote:
Show 10 quoted lines
> Adam Simpkins <adam@adamsimpkins.net> writes:
> 
> > - I don't really like the behavior for any of the cases under 2.2.2.
> >
> >   I especially don't like the fact that the output does not end in a
> >   terminating newline for case 2.2.2.1.
> 
> This is exactly why I did tformat so that we do not have to have a complex
> special case (Jeff and I exchanged a few weatherbaloon patches on the list
> trying out heuristics) to avoid breaking existing scripts that use format.
Hmm.  Here's another possible option to kick around:

Modify the argument parsing code to set use_terminator for --pretty=format when -z is not supplied. In other words:

  - If the -z argument is used (diffopt->line_termination is '\0'),
    the code has separator semantics, just like it always has.
    '\0' appears between the entries, and not at the end of the last
    one.
  - If the -z argument is not used (diffopt->line_termination is '\n'),
    the code has terminator semantics.  '\n' appears at the end of each
    entry.

The only change to the current behavior is that if the -z option is not used, an extra newline will appear at the end of the output. This might confuse some scripts that don't use -z.

The nice thing about this change is that now all of the cases under 2.2.2 from my initial email behave identically. These cases are the most annoying to distinguish and handle correctly for the new --graph code, so it would make the graph logic simpler.

Do you think this change would be acceptable, or would it still break too many scripts?

-- 
Adam Simpkins
adam@adamsimpkins.net
Previous: Junio C Hamano
Message 3 of 3 in “entry terminator/separator behavior in show_log()”
  1. Adam SimpkinsApr 28, 2008
  2. Junio C HamanoApr 28, 2008
  3. Adam SimpkinsApr 29, 2008

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.