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

Re: [PATCH] diff: add --ignore-blank-lines option

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 17, 2013, 23:27 UTC
Message-ID
<7v38sgb9o8.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CALWbr2x0gxQ8boXEa3WJUbaA8e9imt9Ri_NFmANEhJuK6Moi+A@mail.gmail.com>
Antoine Pelisse <apelisse@gmail.com> writes:
> Re-reading note: OK, This last sentence ("If not we will eventually be
> too far and break") is actually a bug. We might break before we find
> something interesting while we should keep going. For example in such
> a case, we should display like this, but won't:
Glad to see that my question has helped ;-)
Show 39 quoted lines
>> This is on the else side of if (!xch->ignore), so we are looking at
>> ignored hunk, which means there is only blank line change.  Can chg2
>> be 0 while chg1 is not zero, i.e. xch being a blank line removal?
>
> Exactly. It can be a blank line removal. But I don't want to consider
> it in the calculation.
> Here's why:
> ...
> What should be the output of diff --ignore-blank-lines ?
>
> I chose this alternative:
> @@ -1,3 +1,4 @@
> +change
>  1
>  2
>  3
> @@ -7,3 +5,4 @@
>  4
>  5
>  6
> +change
>
> While one could have chosen:
> @@ -1,10 +1,8 @@
> +change
>  1
>  2
>  3
> -
> -
> -
> -
>  4
>  5
>  6
> +change
> ...
> Nothing is interesting here, we just leave the interesting zone (if
> not already left) because everything else failed.

Yes, that asymmetry is what I was wondering if we want to have. If we show additional blanks as a significant event, I am not so sure we can say "Nothing is interesting here".

I do not feel strongly either way, but it just felt somewhat inconsistent.

Thanks.
Previous: Antoine PelisseNext: Antoine Pelisse
Message 24 of 26 in “diff: add --ignore-blank-lines option”
  1. diff: add --ignore-blank-lines optionAntoine Pelisse, May 26, 2013
  2. Johannes SixtMay 26, 2013
  3. Antoine PelisseMay 27, 2013
  4. Antoine PelisseJun 1, 2013
  5. Junio C HamanoJun 4, 2013
  6. Antoine PelisseJun 4, 2013
  7. Junio C HamanoJun 4, 2013
  8. Antoine PelisseJun 4, 2013
  9. diff: add --ignore-blank-lines optionAntoine Pelisse, Jun 8, 2013
  10. Eric SunshineJun 9, 2013
  11. Junio C HamanoJun 9, 2013
  12. Antoine PelisseJun 9, 2013
  13. Junio C HamanoJun 9, 2013
  14. Antoine PelisseJun 10, 2013
  15. Junio C HamanoJun 10, 2013
  16. Antoine PelisseJun 12, 2013
  17. Junio C HamanoJun 12, 2013
  18. diff: add --ignore-blank-lines optionAntoine Pelisse, Jun 15, 2013
  19. Junio C HamanoJun 17, 2013
  20. Antoine PelisseJun 17, 2013
  21. Antoine PelisseJun 17, 2013
  22. Junio C HamanoJun 17, 2013
  23. Antoine PelisseJun 17, 2013
  24. Junio C HamanoJun 17, 2013
  25. diff: add --ignore-blank-lines optionAntoine Pelisse, Jun 19, 2013
  26. Junio C HamanoJun 19, 2013

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.