fix(penify_hook): handle git ancestor detection#28
Conversation
This update introduces a fix for the issue where the application would throw an error if the selected folder did not contain a .git directory, but its ancestor did. The `find_git_parent` function has been added to the `utils.py` module to traverse up the directory tree and locate the nearest .git folder. This enhancement ensures that the application can correctly identify the Git repository in parent directories, improving usability and preventing runtime errors related to Git operations.
PR Review 🔍
|
PR Code Suggestions ✨
|
User description
This update introduces a fix for the issue where the application would throw an error if the selected folder did not contain a .git directory, but its ancestor did. The
find_git_parentfunction has been added to theutils.pymodule to traverse up the directory tree and locate the nearest .git folder. This enhancement ensures that the application can correctly identify the Git repository in parent directories, improving usability and preventing runtime errors related to Git operations.Description
find_git_parentfunction to traverse up the directory tree and locate the nearest .git folder.mainfunction to utilize this new function, improving usability by preventing errors when the selected folder lacks a .git directory.GitRepoNotFoundErrorfor better error handling when no Git repository is found.Changes walkthrough 📝
main.py
Integrate Git ancestor detection in main functionpenify_hook/main.py
find_git_parentfunction fromutils.py.mainfunction to usefind_git_parentfor determining the Gitfolder path.
utils.py
Add utility function for Git ancestor detectionpenify_hook/utils.py
GitRepoNotFoundErrorexception class.find_git_parentfunction to locate the nearest .gitdirectory.