Closed sandr01d closed 3 months ago
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: https://github.com/wfxr/forgit/issues/373#issuecomment-2019185780
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?
@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