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

Re: [PATCH 3/3] diff.c: simplify diff_opt_break_rewrites()

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 22, 2019, 23:18 UTC
Message-ID
<xmqqpnsocmdh.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<xmqqtvi0e7sv.fsf@gitster-ct.c.googlers.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 6 quoted lines
> It would make it even easier to follow if you did
>
> 	if (*arg == '/') {
> 		opt2 = ...;
> 		arg++;
> 	} else {

Oops, this should read "else if (!*arg) {", of course, to match the original. Sorry for the noise.

> 		opt2 = 0;
> 	}

And then we'd want a blank line here to make it clear that the previous if/else cascade has finished, and the error checking we see next is not part of it.

Show 6 quoted lines
> 	if (*arg)
> 		return error(...);
>
> It makes it clear that opt2==0 means <n> form and not <n>/<m> form,
> by having an explicit assignment while we parse what *arg points at,
> without the initialization to 0 in the variable definition.
Previous: Junio C HamanoNext: Nguyễn Thái Ngọc Duy
Message 5 of 10 in “nd/diff-parseopt fixups”
  1. 0/3 nd/diff-parseopt fixupsNguyễn Thái Ngọc Duy, Jan 22, 2019
  2. 1/3 Revert "parse-options: allow keep-unknown + stop-at-non-opt combination"Nguyễn Thái Ngọc Duy, Jan 22, 2019
  3. 3/3 diff.c: simplify diff_opt_break_rewrites()Nguyễn Thái Ngọc Duy, Jan 22, 2019
  4. Junio C HamanoJan 22, 2019
  5. Junio C HamanoJan 22, 2019
  6. 2/3 diff.c: delete unused functionsNguyễn Thái Ngọc Duy, Jan 22, 2019
  7. 0/3 nd/diff-parseopt fixupsNguyễn Thái Ngọc Duy, Jan 22, 2019
  8. 1/3 Revert "parse-options: allow keep-unknown + stop-at-non-opt combination"Nguyễn Thái Ngọc Duy, Jan 22, 2019
  9. 2/3 diff.c: delete unused functionsNguyễn Thái Ngọc Duy, Jan 22, 2019
  10. 3/3 diff.c: simplify diff_opt_break_rewrites()Nguyễn Thái Ngọc Duy, Jan 22, 2019

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.