Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 --file-transformation is applied to hunk header but not diff header #1010

Closed
salmankhilji opened this issue Mar 15, 2022 · 1 comment · Fixed by #1012
Closed

🐛 --file-transformation is applied to hunk header but not diff header #1010

salmankhilji opened this issue Mar 15, 2022 · 1 comment · Fixed by #1012

Comments

@salmankhilji
Copy link

--file-transformation does not seem to do anything. Perhaps, I am not sure how to use it properly? Maybe, the fix is to elaborate with a working example within the documentation!

Repro Steps

  1. seq 5 >foo

  2. seq 8 >bar

  3. Run delta like this:

    $ delta --width=80 -s --hunk-header-style=omit --file-style=none --file-transformation='s,foo,bar,' foo bar
    
    foo ⟶   bar
    ────────────────────────────────────────────────────────────────────────────────
    
    │  3 │3                                 │  3 │3
    │  4 │4                                 │  4 │4
    │  5 │5                                 │  5 │5
    │    │                                  │  6 │6
    │    │                                  │  7 │7
    │    │                                  │  8 │8
    precor@byteevo-scm:~/Scratch$ 
    

Observed Behavior

Observe the following within the header:

foo ⟶   bar

Expected Behavior

If the sed like expression worked, then I would expect to see:

bar ⟶   bar

Additional Context

#997

$ delta --version
delta 0.12.1
@dandavison dandavison changed the title --file-transformation does not seem to do anything🐛 🐛 --file-transformation is applied to hunk header but not diff header Mar 15, 2022
@dandavison
Copy link
Owner

Hi @salmankhilji, thanks -- you're right, there's a bug. It is currently applied to the file name in the hunk header, but not the "main" file name in the diff header. There was no good reason for that: I made the option for myself and I personally don't use the main diff header (my config is below)! I've pushed a fix in #1012 .

    file-style = omit blue
    hunk-header-style = file line-number syntax

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants