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

Re: [PATCH v2 5/7] diff: use skip-to-optional-val in parsing --relative

From
Jacob Keller <jacob.keller@gmail.com>
Date
Dec 7, 2017, 19:03 UTC
Message-ID
<CA+P7+xp0b-6936K3_2hN3LH4wh8k+Hkgukh6aC2CRF1QdQ_FUQ@mail.gmail.com>
In-Reply-To
<20171207173034.12865-2-gitster@pobox.com>
On Thu, Dec 7, 2017 at 9:30 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 27 quoted lines
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
>  diff.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/diff.c b/diff.c
> index cd032c6367..e99ac6ec8a 100644
> --- a/diff.c
> +++ b/diff.c
> @@ -4563,11 +4563,10 @@ int diff_opt_parse(struct diff_options *options,
>                 options->flags.rename_empty = 1;
>         else if (!strcmp(arg, "--no-rename-empty"))
>                 options->flags.rename_empty = 0;
> -       else if (!strcmp(arg, "--relative"))
> +       else if (skip_to_optional_val_default(arg, "--relative", &arg, NULL)) {
>                 options->flags.relative_name = 1;
> -       else if (skip_prefix(arg, "--relative=", &arg)) {
> -               options->flags.relative_name = 1;
> -               options->prefix = arg;
> +               if (arg)
> +                       options->prefix = arg;
>         }
>
>         /* xdiff options */
> --
> 2.15.1-480-gbc5668f98a
>
Yea, this is exactly what I had imagined as the fix.

Thanks, Jake

Previous: Junio C HamanoNext: Jeff King
Message 9 of 15 in “diff: add test showing regression to --relative”
  1. diff: add test showing regression to --relativeJacob Keller, Dec 7, 2017
  2. Jeff KingDec 7, 2017
  3. Jacob KellerDec 7, 2017
  4. 0/7 reroll of cc/skip-to-optional-valJunio C Hamano, Dec 7, 2017
  5. 6/7 t4045: reindent to make helpers readableJunio C Hamano, Dec 7, 2017
  6. 7/7 t4045: test 'diff --relative' for realJunio C Hamano, Dec 7, 2017
  7. Jacob KellerDec 7, 2017
  8. 5/7 diff: use skip-to-optional-val in parsing --relativeJunio C Hamano, Dec 7, 2017
  9. Jacob KellerDec 7, 2017
  10. Jeff KingDec 7, 2017
  11. Junio C HamanoDec 7, 2017
  12. Jeff KingDec 7, 2017
  13. Junio C HamanoDec 7, 2017
  14. Jeff KingDec 8, 2017
  15. Junio C HamanoDec 8, 2017

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.