Skip to content

[BUG] dotbare fcheckout -s preview would break if selected files contain spaces #14

Open
@kazhala

Description

In v1.2.0, I added support for staging files with spaces. Most of them are handled through bash array with something like ${array[@]} to respect spaces between indexes. All of them works very well with git commands, however, for some reason, git diff just doesn't like ${array[@]} and this breaks the preview for dotbare fcheckout -s If I do try it I get an error. Well if I do use ${array[*]}, git diff is happy, however, preview for files containing spaces would break due to the asterisk does not respect spaces any more.

Note: This doesn't affect any actual functionalities of dotbare, it's just preview that's breaking.
I'm quite stuck on this, although this won't affect any functionalities and it's unlikely for anyone to experience this, I'll just leave this one here.

Relevant lines:

| fzf --no-multi --header="${header}" --preview "echo {} \
| awk '{print \$1}' \
| xargs -I __ /usr/bin/git --git-dir=${DOTBARE_DIR} --work-tree=${DOTBARE_TREE} \
diff --color=always __ ${files[*]}" \

This works for normal files but not files with spaces. If I do change it to ${files[@]}, none of them will work.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions