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

fix: gd show empty preview when path has spaces #204

Merged
merged 1 commit into from
May 29, 2022
Merged

fix: gd show empty preview when path has spaces #204

merged 1 commit into from
May 29, 2022

Conversation

wfxr
Copy link
Owner

@wfxr wfxr commented May 20, 2022

Check list

  • I have performed a self-review of my code
  • I have commented my code in hard-to-understand areas
  • I have made corresponding changes to the documentation

Description

See #203

Type of change

  • Bug fix
  • New feature
  • Refactor
  • Breaking change
  • Documentation change

Test environment

  • Shell
    • bash
    • zsh
    • fish
  • OS
    • Linux
    • Mac OS X
    • Windows
    • Others:

@wfxr wfxr mentioned this pull request May 20, 2022
10 tasks
@wfxr
Copy link
Owner Author

wfxr commented May 20, 2022

@cjappl Can you help fix the fish part?

@cjappl
Copy link
Collaborator

cjappl commented May 29, 2022

I'm going to merge this, as I tried for a bit yesterday to fix in fish and was having issues.

Made #206 to track it. I noticed that this issue happens in both gd and ga for fish, you should check that ga doesn't have this problem as well in zsh.

@cjappl cjappl merged commit 6385f85 into master May 29, 2022
@cjappl cjappl deleted the fix-gd branch May 29, 2022 00:04
@wfxr
Copy link
Owner Author

wfxr commented May 29, 2022

Thank you @cjappl.

I noticed that this issue happens in both gd and ga for fish, you should check that ga doesn't have this problem as well in zsh.

ga works as expected in zsh:
image

@max-ae
Copy link
Contributor

max-ae commented Jun 1, 2022

Thanks for the fix!
However, the following issue is now present: relative paths do not show anymore in gd fzf selection list.

Consider the following directory structure:
foo/bar/file

Working directory is bar, file has changes.

ga lists file, while gd lists foo/bar/file

carlfriedrich added a commit to carlfriedrich/forgit that referenced this pull request Jan 30, 2023
This had been fixed before in wfxr#189, but obviously the patch broke
support for whitespaces in file names. That was fixed in wfxr#204, which
in turn broke support for renames again.

Unfortunately we cannot support both cases together with the existing
'xargs' implementation, because the arguments are interpreted either
as one single file name (which breaks renames, because we have two files
passed in this case) or as separate file names (which breaks whitespace
support, because git would interpret each word of the file name as a
separate file).

This patch moves away from xargs and stores the file names in a bash
array instead. This makes it possible to pass them to "git diff" quoted
one by one using the "${array[@]}" notation.
carlfriedrich added a commit that referenced this pull request Feb 28, 2023
This had been fixed before in #189, but obviously the patch broke
support for whitespaces in file names. That was fixed in #204, which
in turn broke support for renames again.

Prepare the list of file names with the null-character \0 as a delimiter,
so that we can use "xargs -0" to read it. This makes renames as well
as filenames with spaces work correctly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants