Vaelatern/init-dotfiles

Use default git commit name/email if not set already?

Closed this issue · 5 comments

If a user doesn't have user.name or user.email set in their gitconfig, then the git commit -m "Initial commit" step will fail.

Is this the right way to handle that scenario? Or is it better to prompt the user? Or is it better just to use some default name/email like easy-dotfiles <aviator45003/easy-dotfiles>.

This is part of why the install process is done first. We are, however, currently making the assumption that their .gitconfig is set up prior to this. There is no flag specifically checking the .gitconfig being correct, but if they choose to not install their dotfiles, the commit won't be made (the installerrun flag goes to 0).

I would be up to helping the user set up their name and email if it is not set.

That sounds like a good idea. Just reading the things in and passing them to git config --global user.{name,email} seems reasonable.

And I can test because git config returns a 1 if it fails to find a value.

You can also test the return value of git config --get user.{name,email}.

Addressed, testing the code before committing.