-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix _forgit_diff on macOS #375
Conversation
Since this is a regression from #326, I'd like to merge this before the release next week. |
This still works with mac and fish 👍 It appears I also have the newer version of bash, so that's why we hadn't seen it before. Thanks for the quick fix. |
FYI this still doesn't work with bash 3.2: #373 (comment) |
In bash 3.2 uninitialized arrays contain one entry: an empty string, whereas in modern versions of bash they do not contain any entry. Make sure the $commits and $files arrays are explicitly initialized as empty arrays to allow git to fall back to diffing local changes instead of trying to diff against a revision with a name of an empty string.
Thanks for the hint with the bash docker container @keatsfonam, this helped me track it down. Will keep that in mind for future issues. I got it working in bash 3.2 in the container. Could you give it another try? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passes both fish with newer bash (5.2) and in the docker container for me.
OK to merge once the reporting user says it's all good!
@sandr01d new fix works for me, thank you |
Check list
Description
In bash 3.2 uninitialized arrays contain one entry: an empty string, whereas in modern versions of bash they do not contain any entry. I could not find documentation on this but the behavior can be verified by running the following script:
On bash 5.2.26 this prints
On bash 3.2.57 this prints
This PR makes sure the
$commits
and$files
arrays are explicitly initialized as empty arrays to allow git to fall back to diffing local changes instead of trying to diff against a revision with a name of an empty string.Fixes #373
Type of change
Test environment