mirror of
https://gitlab.gnome.org/GNOME/gitg
synced 2024-08-27 20:09:23 +00:00
Coalesce multiple added/removed lines in patch set
This commit is contained in:
parent
d906a32da6
commit
1151d764f7
|
@ -191,6 +191,8 @@ function prepare_patchset(filediv)
|
|||
var a = "a".charCodeAt(0);
|
||||
var r = "r".charCodeAt(0);
|
||||
|
||||
var last = null;
|
||||
|
||||
while (elem != null)
|
||||
{
|
||||
var e = elem;
|
||||
|
@ -210,8 +212,18 @@ function prepare_patchset(filediv)
|
|||
|
||||
if (selected)
|
||||
{
|
||||
// [sign, old_offset, new_offset, length]
|
||||
patches.push([added ? a : r, offset + doffset, offset, length]);
|
||||
var tp = added ? a : r;
|
||||
|
||||
if (last != null && last[0] == tp && last[2] + last[3] == offset)
|
||||
{
|
||||
last[3] += length;
|
||||
}
|
||||
else
|
||||
{
|
||||
// [sign, old_offset, new_offset, length]
|
||||
last = [tp, offset + doffset, offset, length];
|
||||
patches.push(last);
|
||||
}
|
||||
|
||||
doffset += added ? -length : length;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue