[TDF infra] Announcing Gitiles VCS browser (gitweb replacement) and https:// anon git URIs

Guilhem Moulin guilhem at libreoffice.org
Fri Oct 26 13:44:53 UTC 2018


Hi Eike,

On Wed, 17 Oct 2018 at 21:03:45 +0200, Guilhem Moulin wrote:
> On Wed, 17 Oct 2018 at 14:05:27 +0200, Eike Rathke wrote:
>> For diffs I much prefer the gerrit view because it highlights changes
>> within changed lines, for example
>> 
>> https://gerrit.libreoffice.org/plugins/gitiles/core/+/9672d034b9e760f24ac9a6652ab45dee15ee260a%5E%21/
>> vs
>> https://gerrit.libreoffice.org/gitweb?p=core.git;a=commitdiff;h=9672d034b9e760f24ac9a6652ab45dee15ee260a
>> 
>> Would that be possible also with gitiles?

They both show marked changes now :-)

> Not that I know of, and looking at the source I don't think so
> 
> https://gerrit.googlesource.com/gitiles/+/master/java/com/google/gitiles/HtmlDiffFormatter.java#142

I patched this file to make use of Neil Fraser's ‘diff-match-patch’
library and find the array of differences to mark (with semantic
cleanups so the result is readable).  That array is also what's used to
compute the Levenshtein distance, so it should be quite accurate ;-)

On the other hand, gitweb's algorithm is rather dumb and crude.  Only
edits with the same number of deleted & inserted lines are considered;
the marked part is what's left after removing the longest common prefix
& suffix between a removed line is its corresponding insertion.  It's
therefore not possible to have more than one mark per line, and code
reflowing might not marked properly.

Complexity wise gitweb's algorithm has a lower worst case bound (linear
vs. quadratic), but it shouldn't matter in practice as in our case the
marks don't need to be optimal, and the algorithm will give up and
return a sub-optimal solution if it hasn't found the best one under
50ms.

Unfortunately that change is most likely not upstreamable since I had to
abuse the JGit API quite heavily… :-/

-- 
Guilhem.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20181026/c87e2741/attachment.sig>


More information about the LibreOffice mailing list