jimporter / mike

Manage multiple versions of your MkDocs-powered documentation via Git
BSD 3-Clause "New" or "Revised" License
528 stars 47 forks source link

fix: bug when `user.name` is not set in git config #122

Closed mrjk closed 1 year ago

mrjk commented 1 year ago

Hey, I hit this error with 1.1.2:

GIT_COMMITTER_NAME=ci-bot GIT_COMMITTER_EMAIL=ci-bot@example.com mike deploy v1 latest
INFO     -  Cleaning site directory
INFO     -  Building documentation to directory: TRUNCATED/docs/build/site
INFO     -  Documentation built in 0.40 seconds
error: error getting config 'user.name'

Indeed, I never setup my git informations into my git config, I always use environment variables, as I work for different companies, and I don't want to take the chance for my identities to leak across customers. As the key does not exists in my config, it make fails the deployment. So the case you documented in the README.md does not work.

There is a fix attached :D It fixes this commit : https://github.com/jimporter/mike/commit/2faa33ca4cf0da62c9c0ac7fbe8b60688733d7f1

Side question: last release is 14m old, any plans to release a new version soon ? I'd like to fix:

mike = {git = "https://github.com/jimporter/mike", rev = "master"}

in favor of:

mike = "^1.1.3"

Thanks for your great work :)

jimporter commented 1 year ago

Thanks for the detailed report and patch. I fixed this in a slightly different way, allowing users to set GIT_COMMITTER_(NAME|EMAIL) to the empty string if they want to temporarily fall back to the defaults like:

GIT_COMMITTER_EMAIL= mike deploy ...

I also added some unit tests, since this code is evidently tricky enough that I couldn't get it right the first time. :)

Side question: last release is 14m old, any plans to release a new version soon ?

Probably not very soon. The development version has a few breaking changes, so it'll be 2.0, but there are still some open issues that I really think should be resolved before tagging that. #106 at minimum, but I'd like to get everything in the 2.0 milestone done.