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

Partial filename display when space in it #360

Closed
rockandska opened this issue Dec 20, 2019 · 14 comments
Closed

Partial filename display when space in it #360

rockandska opened this issue Dec 20, 2019 · 14 comments
Labels
bug

Comments

@rockandska
Copy link

@rockandska rockandska commented Dec 20, 2019

Original

diff --git a/a b b/a b
new file mode 100644
index 0000000..e69de29

So-Fancy:

─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
added: a
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

The filename is "a b" and not "a"

$ diff-so-fancy --version
Diff-so-fancy: https://github.com/so-fancy/diff-so-fancy
Version      : 1.2.6

Regards,

@scottchiefbaker
Copy link
Contributor

@scottchiefbaker scottchiefbaker commented Dec 20, 2019

Is this true of all files or just files that start with a or b? A/B are special cases in code, so it may be isolated just to them.

@rockandska
Copy link
Author

@rockandska rockandska commented Dec 20, 2019

Seem the same for 'c d'

$ git diff /dev/null c\ d
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
added: c
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

And the same for another test

git diff /dev/null more\ text
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
added: more
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
@scottchiefbaker
Copy link
Contributor

@scottchiefbaker scottchiefbaker commented Dec 20, 2019

I'm not able to recreate what you're seeing:

mkdir baker
cd baker
git init
echo 'Line1' > 'foo bar.txt'
git add .
git commit -m '1'
echo 'Line1a' > 'foo bar.txt'
git diff

This results in:

───
modified: foo bar.txt
───
@ foo bar.txt:1 @
@rockandska
Copy link
Author

@rockandska rockandska commented Dec 20, 2019

Because you are not in the same state as me.
I'm in the case where the file is not already committed (untracked) so the diff is done against /dev/null

$ git diff -- /dev/null c\ d 
diff --git a/c d b/c d
new file mode 100644
index 0000000..e69de29
$ git diff -- /dev/null c\ d | diff-so-fancy 
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
added: c
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

and it works as it does when there is no space in the filename

$ git diff -- /dev/null test-file
diff --git a/test-file b/test-file
new file mode 100644
index 0000000..e69de29
$ git diff -- /dev/null test-file | diff-so-fancy 
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
added: test-file
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
@scottchiefbaker
Copy link
Contributor

@scottchiefbaker scottchiefbaker commented Dec 20, 2019

Still not tracking... when I create a new untracked file named a b and run git diff on it, I get correct output:

:git diff -- /dev/null a\ b
────────────────────────────────────
added: a b
────────────────────────────────────
@ a b:1 @

Can you give me a full set of instructions to recreate the issue?

@rockandska
Copy link
Author

@rockandska rockandska commented Dec 20, 2019

Don't add content to the file is the part who let appear this behavior

$ touch $'un test'
$ git diff -- /dev/null un\ test | diff-so-fancy 
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
added: un
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
$ echo "test" > $'un test'
$ git diff -- /dev/null un\ test | diff-so-fancy 
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
added: un test
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
@ un test:1 @
test
$ 
scottchiefbaker added a commit to scottchiefbaker/diff-so-fancy that referenced this issue Dec 20, 2019
@scottchiefbaker
Copy link
Contributor

@scottchiefbaker scottchiefbaker commented Dec 20, 2019

OK I can recreate it now. Can you try the fix in 24f8924 please?

scottchiefbaker added a commit to scottchiefbaker/diff-so-fancy that referenced this issue Dec 20, 2019
@rockandska
Copy link
Author

@rockandska rockandska commented Dec 21, 2019

LGTM

The filename is no truncated anymore when the file is empty and the filename contain a space with 24f8924

@rockandska
Copy link
Author

@rockandska rockandska commented Dec 21, 2019

Remaining on thing, the cleanup of the color doesn't seem to be done in this case.

image

@scottchiefbaker
Copy link
Contributor

@scottchiefbaker scottchiefbaker commented Dec 24, 2019

I'm unable to recreate the issue you see above. Can you confirm that follow does/doesn't show color on the following line.

git diff -- /dev/null a\ b; echo "This is another line of text"

image

On my test the subsequent line of text is in the neutral gray color I would expect.

@rockandska
Copy link
Author

@rockandska rockandska commented Dec 30, 2019

Seems to happen only when pipe is used, and not related to the fix

image

scottchiefbaker added a commit to scottchiefbaker/diff-so-fancy that referenced this issue Apr 23, 2020
@scottchiefbaker
Copy link
Contributor

@scottchiefbaker scottchiefbaker commented Apr 23, 2020

Can you test again, I just landed a fix.

@scottchiefbaker scottchiefbaker added the bug label Apr 23, 2020
@rockandska
Copy link
Author

@rockandska rockandska commented Apr 23, 2020

Seems ok

image

@scottchiefbaker
Copy link
Contributor

@scottchiefbaker scottchiefbaker commented Apr 23, 2020

Excellent. Thank you!

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.