sixtease (sixtease) wrote,
sixtease
sixtease

git diff on XSL

My colleague Lars came up with a way to see diff on XSL excel files in git. Simple and handy.

to make git diff work

in ~/.gitconfig

    [diff "excel"]
    textconv=xls2csv

in cimp.documents/.git/info/attributes

    *.xls diff=excel

See man 5 gitattributes for details.

Example

    diff --git a/translations/CIMP_Translations.xls b/translations/CIMP_Translations.xls
    index 96fc5f1..c93f2bc 100644
    --- a/translations/CIMP_Translations.xls
    +++ b/translations/CIMP_Translations.xls
    @@ -565,7 +565,8 @@ e-ticket number:                <% $passenger{ETICKET_IDENT_I18N} %>
    Record Locator:                 <% $passenger{PNR} %>
    Passenger status:               n/a

    -Thank you for flying South African Airways
    +Thank you for flying South African Airways.
    +

to make git show work

in bin/xls2csv-filter

    #!/bin/bash
    XLS2CSV_TEMPFILE=`mktemp`
    cat - > $XLS2CSV_TEMPFILE
    xls2csv $XLS2CSV_TEMPFILE
    rm -f $XLS2CSV_TEMPFILE

Example

    > git show a776:translations/CIMP_Translations.xls | xls2csv-filter
    "Text template","Template Parameters","English (if different from ""Text template"" column)","English","/ms","/sa","/tp"
    "Top",,,"Top"
    "Back",,,"Back"
    "Home",,,"Home"
Tags: programming
Subscribe

  • Building musly

    In the course of my Ph.D. program where I transcribe the recordings of Karel Makoň ( http://radio.makon.cz), I have come to need to measure…

  • Anki: Adjusting card order across decks

    For those who don't know: Anki is the answer when you need to memorize isolated pieces of information. For vocabulary, sentences or Kanjis, it is…

  • XML::Entities 1.0 released

    XML::Entities, one of my babies, just saw release 1.0. It's the first module I dared tag as 1.x. XML::Entities is one of the smallest things…

  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 1 comment