Skip to content

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

Merged
merged 5 commits into from
Oct 22, 2016

Conversation

ankostis
Copy link
Contributor

  • Ignore "empty" GIT_DIR vars.
  • Improve documentation on the constructor path parameter.
    Minor repo-code and doc correcions.
    • 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()).

+ 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()`).
@codecov-io
Copy link

codecov-io commented Oct 19, 2016

Current coverage is 94.36% (diff: 96.77%)

Merging #537 into master will increase coverage by 0.02%

@@             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          

Powered by Codecov. Last update caa0ea7...5fac8d4

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.

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?

Copy link
Contributor Author

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

@Byron Byron merged commit 4754fa1 into gitpython-developers:master Oct 22, 2016
@Byron Byron removed the in progress label Oct 22, 2016
@Byron
Copy link
Member

Byron commented Oct 22, 2016

Thanks a lot @ankostis :) !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants