Skip to content

Commit

Permalink
Only check source files that are in "found_docs"
Browse files Browse the repository at this point in the history
  • Loading branch information
mgeier committed Aug 26, 2023
1 parent 7981931 commit 4494822
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
5 changes: 0 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ Caveats

See also `issue #1`_.

* A regression in Sphinx version 7.2 prevents the extension from working
properly when using the ``.. include`` directive. See `Sphinx issue
#11643`_.

* In Sphinx versions 5.0 and 5.1, there has been
a regression in how dependencies are determined.
This could lead to spurious dependencies
Expand Down Expand Up @@ -121,4 +117,3 @@ Similar stuff
guides/feature-flags.html
.. _issue #1: https://github.com/mgeier/sphinx-last-updated-by-git/issues/1
.. _issue #40: https://github.com/mgeier/sphinx-last-updated-by-git/issues/40
.. _Sphinx issue #11643: https://github.com/sphinx-doc/sphinx/issues/11643
14 changes: 10 additions & 4 deletions src/sphinx_last_updated_by_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,16 @@ def _builder_inited(app):

def _source_read(app, docname, source):
env = app.env
# Since Sphinx 7.2, the source-read hook can be called multiple times
# when using .. include
if docname not in env.git_last_updated:
env.git_last_updated[docname] = None
if docname not in env.found_docs:
# Since Sphinx 7.2, "docname" can be None or a relative path
# to a file included with the "include" directive.
# We are only interested in actual source documents.
return
if docname in env.git_last_updated:
# Again since Sphinx 7.2, the source-read hook can be called
# multiple times when using the "include" directive.
return
env.git_last_updated[docname] = None


def _env_merge_info(app, env, docnames, other):
Expand Down

0 comments on commit 4494822

Please sign in to comment.