Powerlevel9k / powerlevel9k

Powerlevel9k was a tool for building a beautiful and highly functional CLI, customized for you. P9k had a substantial impact on CLI UX, and its legacy is now continued by P10k.
https://github.com/romkatv/powerlevel10k
MIT License
13.47k stars 947 forks source link

[Bugfix] Don't unset global git user config after git tests #1221

Closed Syphdias closed 5 years ago

Syphdias commented 5 years ago

Currently running the git unit tests unsets name and email in the global git config.

This PR gets rid of unnecessary variable juggling and simply sets the git config in the new home. The config (/tmp/powerlevel9k-test/.gitconfig) will be removed when the test directory is removed. I also added a "test" (which is a bit of a hack) to check if email or name were changed.

PS: Teardowns are currently called an additional time (see https://github.com/kward/shunit2/issues/112 for details) after shunit finished all tests. It should be fine for now. Just a heads up since I stumbled upon this bug while testing.

Syphdias commented 5 years ago

@dritter I'm confused. How is that not what is being done here? Which is why I deleted most of the setting resets.

I also added the test to ensure the user config modification doesn't happen again. This apparently failed on Mac OS...

dritter commented 5 years ago

Ha! I missed that line (folded away by github).

So I adjust my comment: I wouldn't trust git config --global, and instead just write the config file directly to our newly created HOME folder.. ;)

dritter commented 5 years ago

Thanks @Syphdias .