Code Monkey home page Code Monkey logo

Comments (6)

0xjac avatar 0xjac commented on June 12, 2024 1

@imbrish I have a similar issue and a scenario which I believe to be relevant here:

I have generated files which are committed to a repo. Those files are marked as binary mainly to tell git to not perform any kind of merging on those files. It also hides the diffs on Github/Gitlab which is useful as they should not be reviewed/edited when merging.

However locally, there a few times where I do need to look at the code generation process and investigate what changed in those files. I can easily do this with git diff by passing the --text option, essentially telling git to treat those files as as text (which they actually are).

I want to use delta to do a diff between two generation versions of my files in two separate dir. Ideally I'd like to do delta dirA dirB. Since this calls git it doesn't work. My current work around is to call:

git diff --no-index --color --text -- dirA dirB | delta

which works but is a bit cumbersome.

I believe the issue is here where delta calls git but does not allow passing any extra options to git. It would be great if we could do something along the lines of

delta [OPTIONS] [MINUS_FILE] [PLUS_FILE] -- [GIT_OPTIONS]

which would look like delta dirA dirB -- --text.

from delta.

imbrish avatar imbrish commented on June 12, 2024

By unsetting the diff in .gitattributes, you are telling git that it is not possible to diff the *.md files. Which, if i understand correctly, is what you want on GitHub. The standard behavior is showing such files as binary. It has nothing to do with delta.

If you want to skip these diffs on GitHub, but generate them locally, I guess you could have another attributes file, not included in version control, where you tell git it should diff these files. I am a bit unsure about inheritance though.

from delta.

matteematt avatar matteematt commented on June 12, 2024

I did think that is the case, does that imply then that vscode is behaving how I want due to the fact that it's probably behaving incorrectly?

from delta.

imbrish avatar imbrish commented on June 12, 2024

I don't use vscode myself, but I would imagine it talks with git to be helpful, and not necessarily promises to follow all the rules.

from delta.

th1000s avatar th1000s commented on June 12, 2024

The gitattributes are applied to the output before it is sent to delta or any other pager, see git diff | less - this is what delta works on, and it already mentions binary files.
Setting a different file via git -c core.attributesFile=my_gitattributes diff seemingly can not override the -diff setting.

However, in your specific case, @0xjac, PR #1697 will add an option so you can call -@=--text

from delta.

0xjac avatar 0xjac commented on June 12, 2024

@th1000s I missed that PR. Thanks a lot, it seems perfect. I'll wait for it to be released. πŸš€

from delta.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.