Skip to content

include custom diff drivers for binary files #140

Open

Description

@andreineculau

First of all great collection! 👏

Secondly, I'm wondering if it's on purpose that you don't include a gitconfig with the diff drivers. For example the elixir gitattributes: diff=elixir is redundant if there's no [diff elixir] section in my gitconfig with a textconv command. It's true that sometimes you can do many things, different things to convert a binary to text, but maybe this repo can also be a collection of those alternate diff drivers (?!).

EDIT: my example is not perfect (elixir is builtin since 2y?!). So to rephrase: would you consider including custom diff drivers for binary files, or is the intention for this collection to stick to builtin drivers?

Activity

  1. changed the title [-]missing diff drivers[/-] [+]include custom diff drivers[/+] on Jul 23, 2021
  2. changed the title [-]include custom diff drivers[/-] [+]include custom diff drivers for binary files[/+] on Jul 23, 2021
  3. alexkaratarakis commented on Jul 30, 2021

    @alexkaratarakis
    Member

    Sorry for the delay!

    I think defining custom diff drivers is reasonable for the scope of this repo.

    We could put them in files ending in gitconfig since custom diff drivers are supposed to go there, following the existing pattern that this repo and the gitignore repo is following (but I am open to other suggestions of course). Also, possibly in a dedicated folder for custom diff drivers.

  4. andreineculau commented on Jul 31, 2021

    @andreineculau
    Author

    Nice! I can see when I find some time and contribute with a PR with the drivers I have.

    One suggestion is to name the custom drivers with a prefix e.g. custom-gitattributes-, to avoid conflicts. Silly example to illustrate what I mean.

    # gitattributes
    # include https://github.com/alexkaratarakis/gitattributes/blob/master/sql.gitattributes
    *.sql linguist-detectable=true
    *.sql linguist-language=sql
    *.sql diff=custom-gitattributes-sql
    
    # override diff driver
    *.sql diff=custom-andreineculau-sql
    
    # gitconfig
    # include https://github.com/alexkaratarakis/gitattributes/blob/master/sql.gitconfig
    [diff "custom-gitattributes-sql"]
        textconv = sql-formatter
    
    # add my own diff drivers
    [diff "custom-andreineculau-sql"]
        textconv = sql-formatter --uppercase
    ``
    
  5. alexkaratarakis commented on Aug 1, 2021

    @alexkaratarakis
    Member

    Yeah, that looks intuitive. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions