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

Re: Fwd: possible Improving diff algoritm

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 12, 2012, 20:29 UTC
Message-ID
<7vtxrr2evm.fsf@alter.siamese.dyndns.org>
In-Reply-To
<7vvcc73yzh.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 24 quoted lines
> Kevin <ikke@ikke.info> writes:
>
>> Regularly I notice that the diffs that are provided (through diff, or
>> add -p) tend to disconnect changes that belong to each other and
>> report lines being changed that are not changed.
>>
>> An example for this is:
>>
>>      /**
>> +     * Default parent
>> +     *
>> +     * @var int
>> +     * @access protected
>> +     * @index
>> +     */
>> +    protected $defaultParent;
>> +
>> +    /**
>>
>> I understand this is a valid view of what is changed, but not a very
>> logical view from the point of the user.
>>
>> I wondered if there is a way to improve this, or would that have other
>> consequences.

I forgot to mention consequences. Changing it obviously changes the shape of the diff, hence changes the patch id. Anything that caches output from "git cherry" to match up "identical patches" will need to discard and repopulate its cache. Your "rerere" database will go stale.

Also "kup" tool used at k.org allows an uploader to pretend to upload an incremental diff between two known commits by only sending the GPG signature of the diff the uploader generates. The actual diff is generated on the k.org machine locally and deposited next to the GPG signature file, with the expectation that the signture matches the diff. Changing the output from diff between two versions will break the optimization and force the uploader to upload the diff over the wire.

Previous: KevinNext: Morten Welinder
Message 5 of 18 in “Fwd: possible Improving diff algoritm”
  1. KevinDec 12, 2012
  2. Junio C HamanoDec 12, 2012
  3. Brian J. MurrellDec 12, 2012
  4. KevinDec 12, 2012
  5. Junio C HamanoDec 12, 2012
  6. Morten WelinderDec 12, 2012
  7. Junio C HamanoDec 12, 2012
  8. Andrew ArdillDec 12, 2012
  9. Javier DomingoDec 12, 2012
  10. Junio C HamanoDec 12, 2012
  11. Javier DomingoDec 12, 2012
  12. Michael HaggertyDec 13, 2012
  13. Morten WelinderDec 13, 2012
  14. Geert BoschDec 13, 2012
  15. Junio C HamanoDec 13, 2012
  16. Javier DomingoDec 14, 2012
  17. Bernhard R. LinkDec 14, 2012
  18. Javier DomingoDec 15, 2012

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.