Created by: avbop
I'm not sure if this is actually a bug in fish, but test -d with no argument returns true, and nonexistent environment variables return an empty string, so test -d $XDG_DATA_HOME becomes test -d and returns true when $XDG_DATA_HOME isn't set. test -d "$XDG_DATA_HOME" becomes test -d "" and returns false as expected.
Prior to making this change, I would get an error from dirname when opening a shell and an error from fish when cding.