Re: [BUG] Possible issue with word-diff option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I forgot to mention the version :
I tested with Ubuntu's git 1.9.1 and a 2.1.0 version I built myself

2014-10-23 20:54 GMT+02:00 Éric Alber <eric.alber@xxxxxxxxx>:
> Hi,
>
> I'm currently developing a local web based GUI for git in the same
> fashion as mercurial's 'hg serve': git-webui
> (https://github.com/alberthier/git-webui)
> I tried to add word-diff highlighting in my diff visualization panels.
> I used the '--word-diff=porcelain' option of 'git show' and 'git
> diff'.
>
> Unfortunately I ran into an issue so I want to make sure I understand
> properly the format
> Here is how I interpret this output:
> - A line of the diff no longer corresponds to a line in the source
> file. A line of the source file, is represented between two leading
> '~' markers
> - A line starting with a '+' or '-' is respectively an added or
> removed line fragment
> - A line starting with a ' ' (space) is an unchanged line fragment
>
> The problem is visible with the git-webui repository itself:
>
> git clone https://github.com/alberthier/git-webui
> git show --word-diff=porcelain ed934a7            # This is the head
> of the 'word-diff' branch
> # search for the first occurrence of 'fragment'
>
> In the source code, several lines have been replaced with the
> following single line:
>
>          var fragment = line.substr(1);
>
> But in the diff, 'fragment' and 'line.substr(1);' don't apprear in the
> same '~' block.
> I get:
>
> ~
>          var
> -pre
> +fragment
>   =
> -$('<pre class="diff-view-line">').appendTo(view)[0];
> ~
> [ some removed lines....]
> ~
> -        }
> +line.substr(1);
> ~
>
> By reading this output, it looks like 'var fragment = ' and
> 'line.substr(1);' aren't on the same line.
> I would have expected:
>
> ~
>          var
> -pre
> +fragment
>   =
> -$('<pre class="diff-view-line">').appendTo(view)[0];
> +line.substr(1);
> ~
> [ some removed lines....]
>
> Is there something I miss or is this a bug of git's word-diff algorithm ?
>
> Regards,
>
> Eric
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]