From 0ef12ae4c158fa8ddb78a70dcf8f90966758db81 Mon Sep 17 00:00:00 2001 From: Daniel Watkins Date: Fri, 28 Jul 2017 14:08:56 -0400 Subject: FetchInfo.re_fetch_result has no reason to be public And when using the API interactively, having it show up as public is confusing. --- git/remote.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/git/remote.py b/git/remote.py index fd76e592..b058b3d4 100644 --- a/git/remote.py +++ b/git/remote.py @@ -208,7 +208,7 @@ class FetchInfo(object): NEW_TAG, NEW_HEAD, HEAD_UPTODATE, TAG_UPDATE, REJECTED, FORCED_UPDATE, \ FAST_FORWARD, ERROR = [1 << x for x in range(8)] - re_fetch_result = re.compile(r'^\s*(.) (\[?[\w\s\.$@]+\]?)\s+(.+) -> ([^\s]+)( \(.*\)?$)?') + _re_fetch_result = re.compile(r'^\s*(.) (\[?[\w\s\.$@]+\]?)\s+(.+) -> ([^\s]+)( \(.*\)?$)?') _flag_map = {'!': ERROR, '+': FORCED_UPDATE, @@ -263,7 +263,7 @@ class FetchInfo(object): fetch line is the corresponding line from FETCH_HEAD, like acb0fa8b94ef421ad60c8507b634759a472cd56c not-for-merge branch '0.1.7RC' of /tmp/tmpya0vairemote_repo""" - match = cls.re_fetch_result.match(line) + match = cls._re_fetch_result.match(line) if match is None: raise ValueError("Failed to parse line: %r" % line) -- cgit v1.2.1 From 0b6cde8de6d40715cf445cf1a5d77cd9befbf4d0 Mon Sep 17 00:00:00 2001 From: Erik Johnson Date: Thu, 10 Aug 2017 16:09:35 -0500 Subject: Fix GitError being raised in initial `import git` This catches any raise of one of the custom exceptions defined in `git.exc` during the imports in the dunder init, and raises an `ImportError` in those cases. --- git/__init__.py | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/git/__init__.py b/git/__init__.py index 8c31e309..75247dbf 100644 --- a/git/__init__.py +++ b/git/__init__.py @@ -35,23 +35,26 @@ _init_externals() #{ Imports -from git.config import GitConfigParser # @NoMove @IgnorePep8 -from git.objects import * # @NoMove @IgnorePep8 -from git.refs import * # @NoMove @IgnorePep8 -from git.diff import * # @NoMove @IgnorePep8 -from git.exc import * # @NoMove @IgnorePep8 -from git.db import * # @NoMove @IgnorePep8 -from git.cmd import Git # @NoMove @IgnorePep8 -from git.repo import Repo # @NoMove @IgnorePep8 -from git.remote import * # @NoMove @IgnorePep8 -from git.index import * # @NoMove @IgnorePep8 -from git.util import ( # @NoMove @IgnorePep8 - LockFile, - BlockingLockFile, - Stats, - Actor, - rmtree, -) +from git.exc import * # @NoMove @IgnorePep8 +try: + from git.config import GitConfigParser # @NoMove @IgnorePep8 + from git.objects import * # @NoMove @IgnorePep8 + from git.refs import * # @NoMove @IgnorePep8 + from git.diff import * # @NoMove @IgnorePep8 + from git.db import * # @NoMove @IgnorePep8 + from git.cmd import Git # @NoMove @IgnorePep8 + from git.repo import Repo # @NoMove @IgnorePep8 + from git.remote import * # @NoMove @IgnorePep8 + from git.index import * # @NoMove @IgnorePep8 + from git.util import ( # @NoMove @IgnorePep8 + LockFile, + BlockingLockFile, + Stats, + Actor, + rmtree, + ) +except GitError as exc: + raise ImportError('%s: %s' % (exc.__class__.__name__, exc)) #} END imports -- cgit v1.2.1 From 54709d9efd4624745ed0f67029ca30ee2ca87bc9 Mon Sep 17 00:00:00 2001 From: Dylan Katz Date: Mon, 21 Aug 2017 11:14:37 -0600 Subject: Fix leaking environment variables --- git/repo/base.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/git/repo/base.py b/git/repo/base.py index 28bb2a5d..1dfe9184 100644 --- a/git/repo/base.py +++ b/git/repo/base.py @@ -9,6 +9,7 @@ import logging import os import re import sys +import warnings from git.cmd import ( Git, @@ -50,8 +51,11 @@ BlameEntry = namedtuple('BlameEntry', ['commit', 'linenos', 'orig_path', 'orig_l __all__ = ('Repo',) -def _expand_path(p): - return osp.normpath(osp.abspath(osp.expandvars(osp.expanduser(p)))) +def _expand_path(p, unsafe=True): + if unsafe: + return osp.normpath(osp.abspath(osp.expandvars(osp.expanduser(p)))) + else: + return osp.normpath(osp.abspath(osp.expanduser(p))) class Repo(object): @@ -90,7 +94,7 @@ class Repo(object): # Subclasses may easily bring in their own custom types by placing a constructor or type here GitCommandWrapperType = Git - def __init__(self, path=None, odbt=DefaultDBType, search_parent_directories=False): + def __init__(self, path=None, odbt=DefaultDBType, search_parent_directories=False, unsafe=True): """Create a new Repo instance :param path: @@ -121,7 +125,10 @@ class Repo(object): epath = os.getcwd() if Git.is_cygwin(): epath = decygpath(epath) - epath = _expand_path(epath or path or os.getcwd()) + if unsafe and ("%" in epath or "$" in epath): + warnings.warn("The use of environment variables in paths is deprecated" + + "\nfor security reasons and may be removed in the future!!") + epath = _expand_path(epath or path or os.getcwd(), unsafe) if not os.path.exists(epath): raise NoSuchPathError(epath) @@ -148,7 +155,7 @@ class Repo(object): sm_gitpath = find_worktree_git_dir(dotgit) if sm_gitpath is not None: - self.git_dir = _expand_path(sm_gitpath) + self.git_dir = _expand_path(sm_gitpath, unsafe) self._working_tree_dir = curpath break @@ -862,12 +869,17 @@ class Repo(object): the directory containing the database objects, i.e. .git/objects. It will be used to access all object data + :param unsafe: + if specified, environment variables will not be escaped. This + can lead to information disclosure, allowing attackers to + access the contents of environment variables + :parm kwargs: keyword arguments serving as additional options to the git-init command :return: ``git.Repo`` (the newly created repo)""" if path: - path = _expand_path(path) + path = _expand_path(path, unsafe) if mkdir and path and not osp.exists(path): os.makedirs(path, 0o755) -- cgit v1.2.1 From d1c40f46bd547be663b4cd97a80704279708ea8a Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 3 Aug 2017 17:33:07 -0400 Subject: worktrees: make non-packed refs also work correctly. Turns out aec58a9 did the right thing for /packed/ refs, but didn't work correctly on /unpacked/ refs. So this patch gives unpacked refs the same treatment. Without the fix here, the test added will cause this traceback: ====================================================================== ERROR: Check that we find .git as a worktree file and find the worktree ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pjones/devel/github.com/GitPython/git/test/lib/helper.py", line 92, in wrapper return func(self, path) File "/home/pjones/devel/github.com/GitPython/git/test/test_repo.py", line 938, in test_git_work_tree_dotgit self.assertIsInstance(repo.heads['aaaaaaaa'], Head) File "/home/pjones/devel/github.com/GitPython/git/util.py", line 893, in __getitem__ raise IndexError("No item found with id %r" % (self._prefix + index)) IndexError: No item found with id 'aaaaaaaa' Woops. Things I've learned: - test_remote doesn't work currently if you start on a branch. I think it never did? - Because of 346424da, all *sorts* of stuff in the test suite doesn't work if you name your development branch "packed-refs" (This seems like a bug...) Signed-off-by: Peter Jones --- git/refs/remote.py | 4 ++++ git/refs/symbolic.py | 44 ++++++++++++++++++++------------------------ git/remote.py | 2 +- git/repo/base.py | 22 ++++++++++++++++++---- git/test/test_repo.py | 2 ++ 5 files changed, 45 insertions(+), 29 deletions(-) diff --git a/git/refs/remote.py b/git/refs/remote.py index ef69b5db..0164e110 100644 --- a/git/refs/remote.py +++ b/git/refs/remote.py @@ -36,6 +36,10 @@ class RemoteReference(Head): # are generally ignored in the refs/ folder. We don't though # and delete remainders manually for ref in refs: + try: + os.remove(osp.join(repo.common_dir, ref.path)) + except OSError: + pass try: os.remove(osp.join(repo.git_dir, ref.path)) except OSError: diff --git a/git/refs/symbolic.py b/git/refs/symbolic.py index 90ecb62c..bef6ba3c 100644 --- a/git/refs/symbolic.py +++ b/git/refs/symbolic.py @@ -26,6 +26,14 @@ from .log import RefLog __all__ = ["SymbolicReference"] +def _git_dir(repo, path): + """ Find the git dir that's appropriate for the path""" + name = "%s" % (path,) + if name in ['HEAD', 'ORIG_HEAD', 'FETCH_HEAD', 'index', 'logs']: + return repo.git_dir + return repo.common_dir + + class SymbolicReference(object): """Represents a special case of a reference such that this reference is symbolic. @@ -71,16 +79,11 @@ class SymbolicReference(object): @property def abspath(self): - return join_path_native(self.repo.git_dir, self.path) + return join_path_native(_git_dir(self.repo, self.path), self.path) @classmethod def _get_packed_refs_path(cls, repo): - try: - commondir = open(osp.join(repo.git_dir, 'commondir'), 'rt').readlines()[0].strip() - except (OSError, IOError): - commondir = '.' - repodir = osp.join(repo.git_dir, commondir) - return osp.join(repodir, 'packed-refs') + return osp.join(repo.common_dir, 'packed-refs') @classmethod def _iter_packed_refs(cls, repo): @@ -127,11 +130,12 @@ class SymbolicReference(object): # END recursive dereferencing @classmethod - def _get_ref_info_helper(cls, repo, repodir, ref_path): + def _get_ref_info_helper(cls, repo, ref_path): """Return: (str(sha), str(target_ref_path)) if available, the sha the file at rela_path points to, or None. target_ref_path is the reference we point to, or None""" tokens = None + repodir = _git_dir(repo, ref_path) try: with open(osp.join(repodir, ref_path), 'rt') as fp: value = fp.read().rstrip() @@ -169,16 +173,7 @@ class SymbolicReference(object): """Return: (str(sha), str(target_ref_path)) if available, the sha the file at rela_path points to, or None. target_ref_path is the reference we point to, or None""" - try: - return cls._get_ref_info_helper(repo, repo.git_dir, ref_path) - except ValueError: - try: - commondir = open(osp.join(repo.git_dir, 'commondir'), 'rt').readlines()[0].strip() - except (OSError, IOError): - commondir = '.' - - repodir = osp.join(repo.git_dir, commondir) - return cls._get_ref_info_helper(repo, repodir, ref_path) + return cls._get_ref_info_helper(repo, ref_path) def _get_object(self): """ @@ -433,7 +428,7 @@ class SymbolicReference(object): or just "myreference", hence 'refs/' is implied. Alternatively the symbolic reference to be deleted""" full_ref_path = cls.to_full_path(path) - abs_path = osp.join(repo.git_dir, full_ref_path) + abs_path = osp.join(repo.common_dir, full_ref_path) if osp.exists(abs_path): os.remove(abs_path) else: @@ -484,8 +479,9 @@ class SymbolicReference(object): a proper symbolic reference. Otherwise it will be resolved to the corresponding object and a detached symbolic reference will be created instead""" + git_dir = _git_dir(repo, path) full_ref_path = cls.to_full_path(path) - abs_ref_path = osp.join(repo.git_dir, full_ref_path) + abs_ref_path = osp.join(git_dir, full_ref_path) # figure out target data target = reference @@ -559,8 +555,8 @@ class SymbolicReference(object): if self.path == new_path: return self - new_abs_path = osp.join(self.repo.git_dir, new_path) - cur_abs_path = osp.join(self.repo.git_dir, self.path) + new_abs_path = osp.join(_git_dir(self.repo, new_path), new_path) + cur_abs_path = osp.join(_git_dir(self.repo, self.path), self.path) if osp.isfile(new_abs_path): if not force: # if they point to the same file, its not an error @@ -594,7 +590,7 @@ class SymbolicReference(object): # walk loose refs # Currently we do not follow links - for root, dirs, files in os.walk(join_path_native(repo.git_dir, common_path)): + for root, dirs, files in os.walk(join_path_native(repo.common_dir, common_path)): if 'refs' not in root.split(os.sep): # skip non-refs subfolders refs_id = [d for d in dirs if d == 'refs'] if refs_id: @@ -605,7 +601,7 @@ class SymbolicReference(object): if f == 'packed-refs': continue abs_path = to_native_path_linux(join_path(root, f)) - rela_paths.add(abs_path.replace(to_native_path_linux(repo.git_dir) + '/', "")) + rela_paths.add(abs_path.replace(to_native_path_linux(repo.common_dir) + '/', "")) # END for each file in root directory # END for each directory to walk diff --git a/git/remote.py b/git/remote.py index fd76e592..29c7ed92 100644 --- a/git/remote.py +++ b/git/remote.py @@ -652,7 +652,7 @@ class Remote(LazyMixin, Iterable): continue # read head information - with open(osp.join(self.repo.git_dir, 'FETCH_HEAD'), 'rb') as fp: + with open(osp.join(self.repo.common_dir, 'FETCH_HEAD'), 'rb') as fp: fetch_head_info = [l.decode(defenc) for l in fp.readlines()] l_fil = len(fetch_info_lines) diff --git a/git/repo/base.py b/git/repo/base.py index 28bb2a5d..d607deee 100644 --- a/git/repo/base.py +++ b/git/repo/base.py @@ -74,6 +74,7 @@ class Repo(object): working_dir = None _working_tree_dir = None git_dir = None + _common_dir = None # precompiled regex re_whitespace = re.compile(r'\s+') @@ -169,17 +170,23 @@ class Repo(object): # lets not assume the option exists, although it should pass + try: + common_dir = open(osp.join(self.git_dir, 'commondir'), 'rt').readlines()[0].strip() + self._common_dir = osp.join(self.git_dir, common_dir) + except (OSError, IOError): + self._common_dir = None + # adjust the wd in case we are actually bare - we didn't know that # in the first place if self._bare: self._working_tree_dir = None # END working dir handling - self.working_dir = self._working_tree_dir or self.git_dir + self.working_dir = self._working_tree_dir or self.common_dir self.git = self.GitCommandWrapperType(self.working_dir) # special handling, in special times - args = [osp.join(self.git_dir, 'objects')] + args = [osp.join(self.common_dir, 'objects')] if issubclass(odbt, GitCmdObjectDB): args.append(self.git) self.odb = odbt(*args) @@ -236,6 +243,13 @@ class Repo(object): """ return self._working_tree_dir + @property + def common_dir(self): + """:return: The git dir that holds everything except possibly HEAD, + FETCH_HEAD, ORIG_HEAD, COMMIT_EDITMSG, index, and logs/ . + """ + return self._common_dir or self.git_dir + @property def bare(self): """:return: True if the repository is bare""" @@ -574,7 +588,7 @@ class Repo(object): :note: The method does not check for the existence of the paths in alts as the caller is responsible.""" - alternates_path = osp.join(self.git_dir, 'objects', 'info', 'alternates') + alternates_path = osp.join(self.common_dir, 'objects', 'info', 'alternates') if not alts: if osp.isfile(alternates_path): os.remove(alternates_path) @@ -932,7 +946,7 @@ class Repo(object): * All remaining keyword arguments are given to the git-clone command :return: ``git.Repo`` (the newly cloned repo)""" - return self._clone(self.git, self.git_dir, path, type(self.odb), progress, **kwargs) + return self._clone(self.git, self.common_dir, path, type(self.odb), progress, **kwargs) @classmethod def clone_from(cls, url, to_path, progress=None, env=None, **kwargs): diff --git a/git/test/test_repo.py b/git/test/test_repo.py index a6be4e66..312e67f9 100644 --- a/git/test/test_repo.py +++ b/git/test/test_repo.py @@ -935,6 +935,8 @@ class TestRepo(TestBase): commit = repo.head.commit self.assertIsInstance(commit, Object) + self.assertIsInstance(repo.heads['aaaaaaaa'], Head) + @with_rw_directory def test_git_work_tree_env(self, rw_dir): """Check that we yield to GIT_WORK_TREE""" -- cgit v1.2.1 From 67291f0ab9b8aa24f7eb6032091c29106de818ab Mon Sep 17 00:00:00 2001 From: Dylan Katz Date: Mon, 21 Aug 2017 12:09:37 -0600 Subject: Fixed missing parameter and changed name --- git/repo/base.py | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/git/repo/base.py b/git/repo/base.py index 1dfe9184..d575466d 100644 --- a/git/repo/base.py +++ b/git/repo/base.py @@ -51,11 +51,11 @@ BlameEntry = namedtuple('BlameEntry', ['commit', 'linenos', 'orig_path', 'orig_l __all__ = ('Repo',) -def _expand_path(p, unsafe=True): - if unsafe: - return osp.normpath(osp.abspath(osp.expandvars(osp.expanduser(p)))) - else: - return osp.normpath(osp.abspath(osp.expanduser(p))) +def _expand_path(p, expand_vars=True): + p = osp.expanduser(p) + if expand_vars: + p = osp.expandvars(p) + return osp.normpath(osp.abspath(p)) class Repo(object): @@ -94,7 +94,7 @@ class Repo(object): # Subclasses may easily bring in their own custom types by placing a constructor or type here GitCommandWrapperType = Git - def __init__(self, path=None, odbt=DefaultDBType, search_parent_directories=False, unsafe=True): + def __init__(self, path=None, odbt=DefaultDBType, search_parent_directories=False, expand_vars=True): """Create a new Repo instance :param path: @@ -120,15 +120,17 @@ class Repo(object): :raise InvalidGitRepositoryError: :raise NoSuchPathError: :return: git.Repo """ + epath = path or os.getenv('GIT_DIR') if not epath: epath = os.getcwd() if Git.is_cygwin(): epath = decygpath(epath) - if unsafe and ("%" in epath or "$" in epath): - warnings.warn("The use of environment variables in paths is deprecated" - + "\nfor security reasons and may be removed in the future!!") - epath = _expand_path(epath or path or os.getcwd(), unsafe) + epath = epath or path or os.getcwd() + if expand_vars and ("%" in epath or "$" in epath): + warnings.warn("The use of environment variables in paths is deprecated" + + "\nfor security reasons and may be removed in the future!!") + epath = _expand_path(epath, expand_vars) if not os.path.exists(epath): raise NoSuchPathError(epath) @@ -155,7 +157,7 @@ class Repo(object): sm_gitpath = find_worktree_git_dir(dotgit) if sm_gitpath is not None: - self.git_dir = _expand_path(sm_gitpath, unsafe) + self.git_dir = _expand_path(sm_gitpath, expand_vars) self._working_tree_dir = curpath break @@ -851,7 +853,7 @@ class Repo(object): return blames @classmethod - def init(cls, path=None, mkdir=True, odbt=DefaultDBType, **kwargs): + def init(cls, path=None, mkdir=True, odbt=DefaultDBType, expand_vars=True, **kwargs): """Initialize a git repository at the given path if specified :param path: @@ -869,7 +871,7 @@ class Repo(object): the directory containing the database objects, i.e. .git/objects. It will be used to access all object data - :param unsafe: + :param expand_vars: if specified, environment variables will not be escaped. This can lead to information disclosure, allowing attackers to access the contents of environment variables @@ -879,7 +881,7 @@ class Repo(object): :return: ``git.Repo`` (the newly created repo)""" if path: - path = _expand_path(path, unsafe) + path = _expand_path(path, expand_vars) if mkdir and path and not osp.exists(path): os.makedirs(path, 0o755) -- cgit v1.2.1 From a2d678792d3154d5de04a5225079f2e0457b45b7 Mon Sep 17 00:00:00 2001 From: Alexis Horgix Chotard Date: Fri, 25 Aug 2017 11:51:22 +0200 Subject: util: move expand_path from repo/base and use it in Git class init --- AUTHORS | 1 + git/cmd.py | 4 ++-- git/repo/base.py | 12 ++++-------- git/util.py | 7 +++++++ 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/AUTHORS b/AUTHORS index ad7c452c..f0c02e33 100644 --- a/AUTHORS +++ b/AUTHORS @@ -19,5 +19,6 @@ Contributors are: -Timothy B. Hartman -Konstantin Popov -Peter Jones +-Alexis Horgix Chotard Portions derived from other open source works and are clearly marked. diff --git a/git/cmd.py b/git/cmd.py index 3637ac9e..a2fcf50d 100644 --- a/git/cmd.py +++ b/git/cmd.py @@ -31,7 +31,7 @@ from git.compat import ( ) from git.exc import CommandError from git.odict import OrderedDict -from git.util import is_cygwin_git, cygpath +from git.util import is_cygwin_git, cygpath, expand_path from .exc import ( GitCommandError, @@ -405,7 +405,7 @@ class Git(LazyMixin): It is meant to be the working tree directory if available, or the .git directory in case of bare repositories.""" super(Git, self).__init__() - self._working_dir = working_dir + self._working_dir = expand_path(working_dir) self._git_options = () self._persistent_git_options = [] diff --git a/git/repo/base.py b/git/repo/base.py index 28bb2a5d..74d56ee5 100644 --- a/git/repo/base.py +++ b/git/repo/base.py @@ -29,7 +29,7 @@ from git.index import IndexFile from git.objects import Submodule, RootModule, Commit from git.refs import HEAD, Head, Reference, TagReference from git.remote import Remote, add_progress, to_progress_instance -from git.util import Actor, finalize_process, decygpath, hex_to_bin +from git.util import Actor, finalize_process, decygpath, hex_to_bin, expand_path import os.path as osp from .fun import rev_parse, is_git_dir, find_submodule_git_dir, touch, find_worktree_git_dir @@ -50,10 +50,6 @@ BlameEntry = namedtuple('BlameEntry', ['commit', 'linenos', 'orig_path', 'orig_l __all__ = ('Repo',) -def _expand_path(p): - return osp.normpath(osp.abspath(osp.expandvars(osp.expanduser(p)))) - - class Repo(object): """Represents a git repository and allows you to query references, gather commit information, generate diffs, create and clone repositories query @@ -121,7 +117,7 @@ class Repo(object): epath = os.getcwd() if Git.is_cygwin(): epath = decygpath(epath) - epath = _expand_path(epath or path or os.getcwd()) + epath = expand_path(epath or path or os.getcwd()) if not os.path.exists(epath): raise NoSuchPathError(epath) @@ -148,7 +144,7 @@ class Repo(object): sm_gitpath = find_worktree_git_dir(dotgit) if sm_gitpath is not None: - self.git_dir = _expand_path(sm_gitpath) + self.git_dir = expand_path(sm_gitpath) self._working_tree_dir = curpath break @@ -867,7 +863,7 @@ class Repo(object): :return: ``git.Repo`` (the newly created repo)""" if path: - path = _expand_path(path) + path = expand_path(path) if mkdir and path and not osp.exists(path): os.makedirs(path, 0o755) diff --git a/git/util.py b/git/util.py index 5553a0aa..39efdb1a 100644 --- a/git/util.py +++ b/git/util.py @@ -340,6 +340,13 @@ def finalize_process(proc, **kwargs): ## TODO: No close proc-streams?? proc.wait(**kwargs) + +def expand_path(p): + try: + return osp.normpath(osp.abspath(osp.expandvars(osp.expanduser(p)))) + except: + return None + #} END utilities #{ Classes -- cgit v1.2.1 From 52912b549289b9df7eeada50691139df6364e92d Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 7 Sep 2017 23:23:45 -0400 Subject: BF: use get, not casting get_value while dealing with submodule path/url etc --- git/objects/submodule/base.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/git/objects/submodule/base.py b/git/objects/submodule/base.py index e3912d88..a6b4caed 100644 --- a/git/objects/submodule/base.py +++ b/git/objects/submodule/base.py @@ -123,12 +123,12 @@ class Submodule(IndexObject, Iterable, Traversable): reader = self.config_reader() # default submodule values try: - self.path = reader.get_value('path') + self.path = reader.get('path') except cp.NoSectionError: raise ValueError("This submodule instance does not exist anymore in '%s' file" % osp.join(self.repo.working_tree_dir, '.gitmodules')) # end - self._url = reader.get_value('url') + self._url = reader.get('url') # git-python extension values - optional self._branch_path = reader.get_value(self.k_head_option, git.Head.to_full_path(self.k_head_default)) elif attr == '_name': @@ -1168,11 +1168,11 @@ class Submodule(IndexObject, Iterable, Traversable): for sms in parser.sections(): n = sm_name(sms) - p = parser.get_value(sms, 'path') - u = parser.get_value(sms, 'url') + p = parser.get(sms, 'path') + u = parser.get(sms, 'url') b = cls.k_head_default if parser.has_option(sms, cls.k_head_option): - b = str(parser.get_value(sms, cls.k_head_option)) + b = str(parser.get(sms, cls.k_head_option)) # END handle optional information # get the binsha -- cgit v1.2.1 From 2b3c16c39953e7a6f55379403ca5d204dcbdb1e7 Mon Sep 17 00:00:00 2001 From: Benjamin Poldrack Date: Thu, 31 Aug 2017 02:35:36 +0200 Subject: BF: Added missing NullHandler to logger in git.remote --- git/remote.py | 1 + 1 file changed, 1 insertion(+) diff --git a/git/remote.py b/git/remote.py index fd76e592..c3a51744 100644 --- a/git/remote.py +++ b/git/remote.py @@ -38,6 +38,7 @@ from .refs import ( log = logging.getLogger('git.remote') +log.addHandler(logging.NullHandler()) __all__ = ('RemoteProgress', 'PushInfo', 'FetchInfo', 'Remote') -- cgit v1.2.1 From edb28b9b2c2bd699da0cdf5a4f3f0f0883ab33a2 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Mon, 25 Sep 2017 21:16:04 +0200 Subject: version bump --- VERSION | 2 +- git/ext/gitdb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index cd57a8b9..399088bf 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.1.5 +2.1.6 diff --git a/git/ext/gitdb b/git/ext/gitdb index 38866bc7..c0fd43b5 160000 --- a/git/ext/gitdb +++ b/git/ext/gitdb @@ -1 +1 @@ -Subproject commit 38866bc7c4956170c681a62c4508f934ac826469 +Subproject commit c0fd43b5ff8c356fcf9cdebbbbd1803a502b4651 -- cgit v1.2.1 From 2dca537f505e93248739478f17f836ae79e00783 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Mon, 25 Sep 2017 21:25:39 +0200 Subject: Apparently bdist_wheel is only in python3 At least on my system. So why not hardcode it here. Ideally this would be changed to docker or vitualenv. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4c72721c..c6ce5a9c 100644 --- a/Makefile +++ b/Makefile @@ -14,5 +14,5 @@ release: clean force_release: clean git push --tags - python setup.py sdist bdist_wheel + python3 setup.py sdist bdist_wheel twine upload -s -i byronimo@gmail.com dist/* -- cgit v1.2.1 From f6cf7a7bd864fe1fb64d7bea0c231c6254f171e7 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 28 Sep 2017 14:37:04 +0200 Subject: Fix test_docs It's not portable to test for a secific author name --- git/test/test_docs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/git/test/test_docs.py b/git/test/test_docs.py index cbbd9447..1ba3f482 100644 --- a/git/test/test_docs.py +++ b/git/test/test_docs.py @@ -289,9 +289,9 @@ class Tutorials(TestBase): assert len(headcommit.hexsha) == 40 assert len(headcommit.parents) > 0 assert headcommit.tree.type == 'tree' - assert headcommit.author.name == 'Sebastian Thiel' + assert len(headcommit.author.name) != 0 assert isinstance(headcommit.authored_date, int) - assert headcommit.committer.name == 'Sebastian Thiel' + assert len(headcommit.committer.name) != 0 assert isinstance(headcommit.committed_date, int) assert headcommit.message != '' # ![14-test_references_and_objects] -- cgit v1.2.1