# git diff --chunk-pickaxe?

4 messages from 2009-06-22 to 2009-06-22. Participants: Nguyen Thai Ngoc Duy, Jakub Narebski, René Scharfe.
Thread: https://gitlist.dev/t/19898

## Nguyen Thai Ngoc Duy, 2009-06-22 12:07

Subject: git diff --chunk-pickaxe?
Message-ID: <fcaeb9bf0906220507q45a61dc3w25ad41a4a65a2d5a@mail.gmail.com>
URL: https://gitlist.dev/e/fcaeb9bf0906220507q45a61dc3w25ad41a4a65a2d5a%40mail.gmail.com

```
Hi,

Another use case for Git. This time for .po translations. In GNOME,
.po files are usually updated with intltool, then translations are
updated manually by translators. Intltool updates comments too and
makes it extremely hard to review translations, something like this:

-#. http://en.wikipedia.org/wiki/HD_DVD
 #: ../data/nautilus.xml.in.h:8
+#. http://en.wikipedia.org/wiki/HD_DVD
 msgid "Blank HD DVD Disc"
 msgstr "Đĩa HD DVD trắng"

-#. http://en.wikipedia.org/wiki/Blu-ray_Disc
 #: ../data/nautilus.xml.in.h:10
+#. http://en.wikipedia.org/wiki/Blu-ray_Disc
 msgid "Blu-Ray Video"
 msgstr "Phim Blu-Ray"

-#. http://en.wikipedia.org/wiki/Red_Book_(audio_CD_standard)
 #: ../data/nautilus.xml.in.h:12
+#. http://en.wikipedia.org/wiki/Red_Book_(audio_CD_standard)
 msgid "Compact Disc Audio"
 msgstr "Đĩa nhạc Compact Disc"

What I want is only show diff chunks that add or remove a line that
does not start with '#', something like a chunk-level pickaxe. Any
pointer where to start? It looks like I can start from
xdi_diff_outf(). Just wanted to make sure I won't follow a wrong way
from the beginning.
-- 
Duy

```

## Jakub Narebski, 2009-06-22 12:27

Subject: Re: git diff --chunk-pickaxe?
Message-ID: <h1nt21$lk4$1@ger.gmane.org>
URL: https://gitlist.dev/e/h1nt21%24lk4%241%40ger.gmane.org
In-Reply-To: <fcaeb9bf0906220507q45a61dc3w25ad41a4a65a2d5a@mail.gmail.com>

```
Nguyen Thai Ngoc Duy wrote:

> What I want is only show diff chunks that add or remove a line that
> does not start with '#', something like a chunk-level pickaxe. Any
> pointer where to start? It looks like I can start from
> xdi_diff_outf(). Just wanted to make sure I won't follow a wrong way
> from the beginning.

Perhaps you can use textconv here?

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

```

## René Scharfe, 2009-06-22 12:48

Subject: Re: git diff --chunk-pickaxe?
Message-ID: <4A3F7DAC.3090709@lsrfire.ath.cx>
URL: https://gitlist.dev/e/4A3F7DAC.3090709%40lsrfire.ath.cx
In-Reply-To: <fcaeb9bf0906220507q45a61dc3w25ad41a4a65a2d5a@mail.gmail.com>

```
Nguyen Thai Ngoc Duy schrieb:
> What I want is only show diff chunks that add or remove a line that
> does not start with '#', something like a chunk-level pickaxe. Any
> pointer where to start? It looks like I can start from
> xdi_diff_outf(). Just wanted to make sure I won't follow a wrong way
> from the beginning.

How about creating an external diff driver instead?  It could remove all
lines starting with '#', or normalize such lines to just '#' in case you
need the line numbers to remain unchanged, then write the filtered
result into temporary files and compare them with diff.  Perhaps this is
sufficient for your purposes?  It should be easier to implement.

(Keywords: GIT_EXTERNAL_DIFF, --ext-diff, diff.<name>.command)

René

```

## Nguyen Thai Ngoc Duy, 2009-06-22 13:04

Subject: Re: git diff --chunk-pickaxe?
Message-ID: <fcaeb9bf0906220604ubb9db7v9ea37416080eecd7@mail.gmail.com>
URL: https://gitlist.dev/e/fcaeb9bf0906220604ubb9db7v9ea37416080eecd7%40mail.gmail.com
In-Reply-To: <4A3F7DAC.3090709@lsrfire.ath.cx>

```
On Mon, Jun 22, 2009 at 10:48 PM, René
Scharfe<rene.scharfe@lsrfire.ath.cx> wrote:
> Nguyen Thai Ngoc Duy schrieb:
>> What I want is only show diff chunks that add or remove a line that
>> does not start with '#', something like a chunk-level pickaxe. Any
>> pointer where to start? It looks like I can start from
>> xdi_diff_outf(). Just wanted to make sure I won't follow a wrong way
>> from the beginning.
>
> How about creating an external diff driver instead?  It could remove all
> lines starting with '#', or normalize such lines to just '#' in case you
> need the line numbers to remain unchanged, then write the filtered
> result into temporary files and compare them with diff.  Perhaps this is
> sufficient for your purposes?  It should be easier to implement.

Yep. Jakub mentioned textconv privately, which should be enough for
review purpose. However I'm not completely satisfied with it. Let's
say I'm done review and happy with most of the translated strings. I'd
like to commit those strings only (whether comments are committed does
not really matter because I can filter them out with textconv). If I
start "git add -p" up, I'm in trouble again.
-- 
Duy

```
