Comments (12)
Workaround:
Add the following alias:
[alias]
xdsf = !"git -c interactive.diffFilter='less --tabs=4 -RFX' \"$@\" # Don't use DSF"
Usage:
git xdsf add --patch
from diff-so-fancy.
Note that the issue here is the two blank lines being added by dsf
.
The cause is likely the same as the one causing issue #473.
from diff-so-fancy.
Hi! I ran into the similar issue on a binary diff (.png file). Hope that helps!
from diff-so-fancy.
Is this still an active with v1.4.5? I am unable to recreate the issue with the steps you provided above.
bakers@basement(~/github/diff-so-fancy)
$ git rm README.md
rm 'README.md'
bakers@basement(~/github/diff-so-fancy)
$ git status --short
D README.md
bakers@basement(~/github/diff-so-fancy)
$ git add --patch README.md
No changes.
from diff-so-fancy.
I think the deletion in OP must have been unstaged (i.e. rm
not git rm
) @scottchiefbaker, otherwise git add -p
will always skip it, won't hit dsf.
from diff-so-fancy.
@OJFord attempting the same thing with rm
instead of git rm
still "works" for me. Git handles it appropriately and passes it to d-s-f which displays the correct content.
I'm still confused how to recreate this.
from diff-so-fancy.
@scottchiefbaker I just reproduced on master with the following commands:
rm *.png
git add -p
Output is:
felixlinker diff-so-fancy % rm *.png
felixlinker diff-so-fancy % git add -p
error: mismatched output from interactive.diffFilter
hint: Your filter must maintain a one-to-one correspondence
hint: between its input and output lines.
from diff-so-fancy.
I suspect this has something to do with the fact that you're deleting a binary file. I don't get this error when I delete a tracked text file. Here is the raw git diff output for a text file that has been rm
'd.
diff --git a/index.html b/index.html
deleted file mode 100644
index c3ef8be..0000000
--- a/index.html
+++ /dev/null
Here is the raw git diff output for a binary file that has been rm
'd.
diff --git a/image001.png b/image001.png
deleted file mode 100644
index dae0097..0000000
Binary files a/image001.png and /dev/null differ
d-s-f parses removing this binary down to three lines:
─────────────────────────────────
deleted: image001.png (binary)
─────────────────────────────────
Not sure what --patch
is expecting.
from diff-so-fancy.
@scottchiefbaker git
is expecting the number of lines to always be the same.
The input is 4 lines, the transformed output is 3.
To fix: add a blank like above/below the output header to keep the transformed line count the same as the input.
It's the only easily implemented sanity check that the diff filter is not doing something obviously wrong.
from diff-so-fancy.
Related issues: #35 #305 #296 #437 #473
from diff-so-fancy.
I'm still unable to recreate this reliably so it's hard to test. If the issue really is the 4:3 line ratio I'd expect it to pop up all over d-s-f because we do that for every file change? Is this specifically related to binary files? Or does it apply to text files as well?
A "simple" fix would be adding
print "\n";
Right after line 335 which should get you the extra line you're asking for. Try that and let me know?
from diff-so-fancy.
Are you calling d-s-f with --patch
enabled? That is supposed to fix ratios:
# `git add --patch` requires our output to match the number of lines from the
# input. So, when patch mode is active, we print out empty lines to pad our
# output to match any lines we've consumed.
If that's not working we may need to implement the above fix wrapped in a --patch
filter.
from diff-so-fancy.
Related Issues (20)
- unified diffs with -U0 show incorrect line number HOT 13
- `report-bug.sh` is broken? May need to be modernized HOT 2
- no background color when play in gitlab ci HOT 3
- Can I use it with vim-fugitive? HOT 3
- How to remove color for the common portions of lines that differ? --> Light vs Dark Mode challenges on macOS HOT 14
- diff-highlight settings break whitespace error color in some cases HOT 1
- Colors in "diff -u | d-s-f" stop working with stripLeadingSymbols = false HOT 1
- When viewing diff in a subdirectory paths aren't relative HOT 2
- git diff output doesn't scroll using touchpad HOT 3
- Newer version of git are omitting the 0 (zero) in ANSI reset which breaks `$strip_leading_indicators` HOT 1
- 1.4.4 not available on NPM? HOT 1
- --patch not working on specific diff HOT 6
- Make interactive filter respect `less -S` to avoid wrapping lines HOT 2
- How do I change the start path of git log output? HOT 1
- git add --patch shows tabs that are 8 spaces wide HOT 4
- Whitespace deletions on empty lines don’t get highlighted correctly HOT 1
- Broken link in ZSH install instructions HOT 1
- Add awesomebot link checks on README.md
- Only-added/only-removed lines aren't highlighted
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from diff-so-fancy.