Skip to content

Update to pre-commit-git-diff-docx.sh#112

Open
scfast wants to merge 1 commit intovigente:masterfrom
scfast:patch-1
Open

Update to pre-commit-git-diff-docx.sh#112
scfast wants to merge 1 commit intovigente:masterfrom
scfast:patch-1

Conversation

@scfast
Copy link

@scfast scfast commented Feb 15, 2020

Added some logic that allows for files with spaces in their name

Added some logic that allows for files with spaces in their name
TEMP=""
elif [[ $TEMP == "" ]]
then
TEMP="$file "
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space added here on purpose - don't think this will work if someone adds a file name with a double space in the name, but I think this covers most cases

@rcasero
Copy link
Collaborator

rcasero commented Feb 26, 2020

Hi @scfast , thanks for the PR. I haven't worked with that file for a long time, so please bear with me. Did it give an error if the .docx file had a whitespace?

If so, where in the script was the error?

It looks like you have added some ad hoc code to deal with whitespaces, am I right? But that kind of code shouldn't be necessary, right? Just calling variables with "$file" or "$(foo)" instead of $file should fix the problem.

So if that's the problem, that the script crashes when there's a whitespace in the file name, what I'd suggest is just checking whether there's an unquoted variable somewhere, and quoting it, instead of adding ad hoc code, specially if the code can deal with one but not more whitespaces.

@scfast
Copy link
Author

scfast commented Mar 7, 2020

Hi @scfast , thanks for the PR. I haven't worked with that file for a long time, so please bear with me. Did it give an error if the .docx file had a whitespace?

If so, where in the script was the error?

It looks like you have added some ad hoc code to deal with whitespaces, am I right? But that kind of code shouldn't be necessary, right? Just calling variables with "$file" or "$(foo)" instead of $file should fix the problem.

So if that's the problem, that the script crashes when there's a whitespace in the file name, what I'd suggest is just checking whether there's an unquoted variable somewhere, and quoting it, instead of adding ad hoc code, specially if the code can deal with one but not more whitespaces.

I'll double-check to be sure - I think both cases are causing issues, but I'll get some specifics for you

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 this pull request may close these issues.

2 participants