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

Re: Antw: [EXT] Re: Help understanding unexpected diff output

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 14, 2020, 18:53 UTC
Message-ID
<xmqqr1tekjwo.fsf@gitster.c.googlers.com>
In-Reply-To
<5F0D7252020000A10003A03E@gwsmtp.uni-regensburg.de>
"Ulrich Windl" <Ulrich.Windl@rz.uni-regensburg.de> writes:
Show 41 quoted lines
>> I would imagine that the answer would still be a very similar looking
>> 
>>     ‑‑‑ a/0/...
>>     +++ b/0/...
>>     @@ ‑5,12 +5,6 @@
>>      olcDatabase: {1}hdb
>>      olcDbDirectory: /var/lib/ldap
>>      olcSuffix: dc=... 
>>     ‑olcAccess: {0} ...
>>     ‑olcAccess: {1} ...
>>     ‑olcAccess: {2} ...
>>     ‑olcAccess: {3} ...
>>     ‑olcAccess: {4} ...
>>     ‑olcAccess: {5} ...
>>     olcLimits: {0}dn.exact=....
>>      olcRootDn: cn=Admin,dc=...
>>      olcRootPW: {SSHA}yZ...
>>     @@ ‑52,6 +46,12 @@
>>      entryUUID: ...
>>      creatorsName: cn=config
>>      createTimestamp: ...
>>     ‑entryCSN: ...
>>     +olcAccess: {0} ...
>>     +olcAccess: {1} ...
>>     +olcAccess: {2} ...
>>     +olcAccess: {3} ...
>>     +olcAccess: {4} ...
>>     +olcAccess: {5} ...
>>     +entryCSN: ...
>>      modifiersName: cn=config
>>     ‑modifyTimestamp: ...
>>     +modifyTimestamp: ...
>> 
>> with identical "olcAccess: {$n}" lines removed from earlier part the
>> file and added to the end of the file.
>> 
>> So I am not sure what you are asking.  It would not be correct to show
>> something like
>
> According to my eyes (just using Emacs to make sure) those olcAccess lines
> "numbered" 0 to 3, and 5 should be "context lines" as they are not changed.

And the "slightly different" example I asked you about has {4} in both blocks identical, you are arguing that these 6 lines all should appear as context?

It certainly is possible but then the patch would look quite different. As "olcAccess: {0}" line in the preimage (i.e. a/) appears at line 8, but that same line appears in the postimage (i.e. b/) at line 49, such a patch that match these two olcAccess blocks as unchanged MUST delete many lines that come after "olcAccess: {5}" in the preimage (i.e. starting at line 14 with olcLimits, line ending at entryCSN: at line 55 must be removed, because they used to appear immediately after "olcAccess: {5}" in the preimage a/, but in the postimage b/, none of tme appear after the "olcAccess: {5}" that you claim to be common and unchanged (in the postimage, instead you have only four lines that has"entryCSN:", "modiferName", etc. before the end of the file).

Of course, these lines in the line range 14-55 actually are the ones that did not change, as we can see above, so if you insist that you must keep the 6-line "olcAccess" block as common and unchanged, because your desired patch is deleting them from the pre-image after "olcAccess: {5}" line, your desired patch must be adding them back to the postimage somewhere (namely, before "olcAccess: {0}" line).

Such a patch is also a valid one in that it expresses the difference between a/ and b/ in terms of a sequence of "delete these lines from here" and "insert these lines to here", but it would be far less interesting than what we see above. Instead of "we deleted 6 lines near the beginning of the file" plus "then added 6 lines near the end--ah, these 6 lines by the way are identical", you would instead say "we deleted the block of lines 14-55 that appear immediately after olcAccess:{5}" plus "we inserted the identical block of lines immediately before olcAccess{0}". And you'd complain in the opposite way: "These lines are identical but appear in different locations in the preimage and the postimage -- why aren't they shown as context lines?"

Previous: Ulrich WindlNext: Philip Oakley
Message 4 of 5 in “Help understanding unexpected diff output”
  1. Ulrich WindlJul 13, 2020
  2. Junio C HamanoJul 13, 2020
  3. Antw: [EXT] Re: Help understanding unexpected diff outputUlrich Windl, Jul 14, 2020
  4. Junio C HamanoJul 14, 2020
  5. Philip OakleyOct 23, 2020

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.