-
-
Notifications
You must be signed in to change notification settings - Fork 934
FIX #535: expand also GIT_DIR var on Repo-construction #537
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
+ Ignore "empty" GIT_DIR vars. + Improve documentation on the constructor `path` parameter.
+ Expansion of paths also `osp.normalize()` them. + Make Repo-fields --> class-fields to avoid initializations on construct. + Explain and rename `git.repo.fun.find_git_dir()` is for submodules (`find_submodule_git_dir()`).
Current coverage is 94.36% (diff: 96.77%)@@ master #537 diff @@
==========================================
Files 63 63
Lines 9885 9892 +7
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 9326 9335 +9
+ Misses 559 557 -2
Partials 0 0
|
Conflicts: git/repo/base.py git/repo/fun.py git/test/test_submodule.py
@@ -124,6 +124,8 @@ def __init__(self, path=None, odbt=DefaultDBType, search_parent_directories=Fals | |||
repo = Repo("~/Development/git-python.git") | |||
repo = Repo("$REPOSITORIES/Development/git-python.git") | |||
|
|||
if `None, current-directory is used. | |||
The :envvar:`GIT_DIR` if set and not empty takes precendance over this parameter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The environment variable taking precedence over the specified path seems error prone and undesirable. For instance, with GIT_DIR
set, you can no longer do something like this:
repo_1 = git.Repo('/path/to/repo1')
repo_2 = git.Repo('/path/to/repo2')
I think GIT_DIR
as a fallback makes sense (if path
is None
for instance). However, is there any reason to prefer it if an explicit path is provided?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussion moved to original issue #535
FIX gitpython-developers#535 according to Byron's comment: gitpython-developers#535 (comment)
Thanks a lot @ankostis :) ! |
path
parameter.Minor repo-code and doc correcions.
osp.normalize()
them.construct.
git.repo.fun.find_git_dir()
is for submodules(
find_submodule_git_dir()
).