fralau / mkdocs-macros-plugin

Create richer and more beautiful pages in MkDocs, by using variables and calls to macros in the markdown code.
https://mkdocs-macros-plugin.readthedocs.io
Other
336 stars 51 forks source link

get_git_info error handling #38

Closed kalanzun closed 4 years ago

kalanzun commented 4 years ago

Diagnosis Information

The except clauses actually return None, because dict().update() returns None.

The pull request changes get_git_info() to actually return the diagnosis information in r. The except clauses now just updates r with r.update({}) and at the very end of the function, get_git_info() returns r.

git repositories without tags

If the git repository has no tags, git describe --tags fails with error code 128 and aborts git_get_config(). However, the other commands still provide useful information.

This pull request adds a try except block around the git call and ignores error 128 for r['tag']. The function continues to collect information for git repositories without tags.

fralau commented 4 years ago

Thanks a lot.

I opened an issue, to respect the usual workflow (issue => discussion => pull request).

fralau commented 4 years ago

Commit a6b6c1e solves this issue (integrates the substance of this PR and expands on it).

@kalanzun Thanks a lot for this!