Skip to content

Comments

Search parent directories#3

Merged
timvink merged 5 commits intotimvink:masterfrom
uliska:search-parent-directories
Feb 26, 2020
Merged

Search parent directories#3
timvink merged 5 commits intotimvink:masterfrom
uliska:search-parent-directories

Conversation

@uliska
Copy link
Contributor

@uliska uliska commented Feb 24, 2020

This will fix #1 by recursively searching parent directories for a valid Git repository (simple flag in git.Repo).

For simplicity (esp. avoiding merge conflicts due to whitespace) I've added this commit on top of #2.

(I don't intend to be nitpicking about whitespace,
but without a separate commit the following commits
would become dirty).
The "authors" return value should be a list (of author dicts),
but in case of failure it returned an empty string.

This was incorrectly handled in Util.summarize(), but
fortunately with no negative effect:
- iterating over a string returns its characters, but
- iterating over an empty string behaves like
  iterating over an empty dict.
Create a cache dictionary, with file paths as key.
Util.get_authors() is called twice, and there's no need
to call Git twice if we can cache the results.
This has been inadvertently been overwritten by copy/paste
Closes timvink#1

This flag for the git.Repo initializer will search parent directories
for a valid Git repository too.
@uliska uliska mentioned this pull request Feb 25, 2020
@timvink
Copy link
Owner

timvink commented Feb 26, 2020

It's an improvement, so I will merge, but not sure it it's the best solution (as discussed in #1)

To close #1 we need a least 1 unit test to cover the case.

@timvink timvink merged commit ee14f91 into timvink:master Feb 26, 2020
@uliska uliska deleted the search-parent-directories branch February 26, 2020 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Traceback when MkDocs directory is not the repository root

2 participants